Diagram Desk

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

MoviePK movie_id inttitle varcharminutes intHallPK hall_id intseats intScreeningPK screening_id intFK movie_id intFK hall_id intstarts_at datetimeSeatPK seat_id intFK hall_id intseat_row varcharBookingPK booking_id intFK screening_id intFK seat_id intshown_inhostshasbookedreserved
ER diagram · 20 shapes

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

ShapeSymbolConnections
MovieEntityholds movie_id, title, minutes · → Screening(shown_in)
HallEntityholds hall_id, seats · → Screening(hosts), Seat(has)
ScreeningEntityholds screening_id, movie_id, hall_id, starts_at · → Booking(booked) · ← Movie, Hall
SeatEntityholds seat_id, hall_id, seat_row · → Booking(reserved) · ← Hall
BookingEntityholds booking_id, screening_id, seat_id · ← Screening, Seat

Symbols used here

SymbolMeaning
EntityA 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 oneTwo short bars at the line end.
Zero or manyA crow's foot and a circle.
One or manyA crow's foot and a bar.

All er diagram symbols and how to draw

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

More er diagram examples

All SeewolLabs tools