CloudSketch AI Logo
FeaturesTemplatesPricingEnterpriseAboutContactLog in
πŸŒ™β˜€οΈ
Log inStart free
Home/Templates/Railways & Public Transport

πŸš† Railways & Public Transport Β· Database ERD

Train Operations Database Schema

Tables for train operations: trains, routes, stations, scheduled stops, coaches and daily running with actual times.

More Railways & Public Transport templates

Drawing diagram…

What this diagram shows

  • The schedule and the actual running are stored separately
  • Each run records actual arrival and departure per station
  • Coach composition can change per run

Prompt used

Train operations database: trains run on routes; a route has an ordered list of stations with scheduled arrival and departure (schedule stops). Each day's train run records actual arrival and departure at each station (run stops) and its coach composition.

Mermaid code
erDiagram
  ROUTE ||--|{ SCHEDULE_STOP : "has stops"
  STATION ||--o{ SCHEDULE_STOP : "appears in"
  TRAIN ||--|| ROUTE : "runs on"
  TRAIN ||--o{ TRAIN_RUN : "runs as"
  TRAIN_RUN ||--|{ RUN_STOP : records
  STATION ||--o{ RUN_STOP : "passed at"
  TRAIN_RUN ||--|{ RUN_COACH : "formed of"
  COACH ||--o{ RUN_COACH : "used in"
  ROUTE {
    int id PK
    string name
  }
  STATION {
    int id PK
    string code
    string name
  }
  SCHEDULE_STOP {
    int id PK
    int route_id FK
    int station_id FK
    int sequence
    time sched_arrival
    time sched_departure
  }
  TRAIN {
    int id PK
    string number
    string name
    int route_id FK
  }
  TRAIN_RUN {
    int id PK
    int train_id FK
    date run_date
    string status
  }
  RUN_STOP {
    int id PK
    int run_id FK
    int station_id FK
    datetime actual_arrival
    datetime actual_departure
  }
  COACH {
    int id PK
    string coach_number
    string class
  }
  RUN_COACH {
    int id PK
    int run_id FK
    int coach_id FK
    int position
  }

Related templates

C4 ArchitectureProRailways & Public Transport

Train Ticket Reservation System

A railway reservation system in the style of IRCTC: seat inventory per train and class, waitlists, Tatkal quota, payments and e-tickets.

State MachineRailways & Public Transport

Train Ticket (PNR) Status

The states of a train ticket from booking to journey, including RAC and waitlist confirmation and cancellation.

SequenceRailways & Public Transport

Metro Smart Card Fare Collection

How a metro fare is charged with a smart card or bank card: tap in at the entry gate, tap out at the exit, fare by distance and balance update.

Data FlowRailways & Public Transport

Live Bus Tracking and Arrival Times

How a city bus app shows live bus positions and arrival times: GPS devices on buses, a prediction model and updates to apps and stop displays.

NetworkRailways & Public Transport

Railway Signalling and Train Control Network

How a modern railway signalling network is connected: interlocking at stations, track circuits, train control radio and the central traffic control centre.

C4 ArchitectureProRailways & Public Transport

Multimodal Journey Planner

A journey planner that combines metro, bus, suburban train and last-mile options into one trip plan with a single ticket.