
π Railways & Public Transport Β· Database ERD
Tables for train operations: trains, routes, stations, scheduled stops, coaches and daily running with actual times.
Drawing diagramβ¦
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.
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
}A railway reservation system in the style of IRCTC: seat inventory per train and class, waitlists, Tatkal quota, payments and e-tickets.
The states of a train ticket from booking to journey, including RAC and waitlist confirmation and cancellation.
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.
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.
How a modern railway signalling network is connected: interlocking at stations, track circuits, train control radio and the central traffic control centre.
A journey planner that combines metro, bus, suburban train and last-mile options into one trip plan with a single ticket.