Cinema booking ERD
Movie, screening, hall, seat and booking. A movie has many screenings and each booking holds one seat, chained as one-to-many relationships.
The diagram
Reading it step by step
- 'Movie' has 3 attributes, primary key movie_id.
- 'Hall' has 2 attributes, primary key hall_id.
- 'Screening' has 4 attributes, primary key screening_id, foreign key movie_id, hall_id.
- 'Seat' has 3 attributes, primary key seat_id, foreign key hall_id.
- 'Booking' has 3 attributes, primary key booking_id, foreign key screening_id, seat_id.
- Each 'Movie' relates to zero or more 'Screening'; each 'Screening' to exactly one 'Movie' (shown_in).
- Each 'Hall' relates to zero or more 'Screening'; each 'Screening' to exactly one 'Hall' (hosts).
- Each 'Hall' relates to one or more 'Seat'; each 'Seat' to exactly one 'Hall' (has).
- Each 'Screening' relates to zero or more 'Booking'; each 'Booking' to exactly one 'Screening' (booked).
- Each 'Seat' relates to zero or more 'Booking'; each 'Booking' to exactly one 'Seat' (reserved).
Shape by shape
| Shape | Symbol | Connections |
|---|---|---|
| Movie | Entity | holds movie_id, title, minutes · → Screening(shown_in) |
| Hall | Entity | holds hall_id, seats · → Screening(hosts), Seat(has) |
| Screening | Entity | holds screening_id, movie_id, hall_id, starts_at · → Booking(booked) · ← Movie, Hall |
| Seat | Entity | holds seat_id, hall_id, seat_row · → Booking(reserved) · ← Hall |
| Booking | Entity | holds booking_id, screening_id, seat_id · ← Screening, Seat |
Symbols used here
| Symbol | Meaning |
|---|---|
| Entity | A thing to store: name on top, attributes below. |
| Primary key (PK) | The attribute that identifies one row; underlined. |
| Foreign key (FK) | An attribute pointing to another entity's key. |
| Exactly one | Two short bars at the line end. |
| Zero or many | A crow's foot and a circle. |
| One or many | A crow's foot and a bar. |
Diagram text
Paste this text into the editor to get the same picture, then change the names to fit your own work.
# Cinema booking ERD
erDiagram
Movie {
int movie_id PK
varchar title
int minutes
}
Hall {
int hall_id PK
int seats
}
Screening {
int screening_id PK
int movie_id FK
int hall_id FK
datetime starts_at
}
Seat {
int seat_id PK
int hall_id FK
varchar seat_row
}
Booking {
int booking_id PK
int screening_id FK
int seat_id FK
}
Movie ||--o{ Screening : shown_in
Hall ||--o{ Screening : hosts
Hall ||--|{ Seat : has
Screening ||--o{ Booking : booked
Seat ||--o{ Booking : reserved