DEV Community

ZeeshanAli-0704
ZeeshanAli-0704

Posted on

X

πŸ”΅ 1. Movie

Represents information about a movie.

Field Type Description
MovieID (PK) int Unique identifier for each movie
Title varchar(256) Title of the movie
Description varchar(512) Summary of the movie
Duration datetime Length of the movie
Language varchar(16) Language of the movie
ReleaseDate datetime Release date
Country varchar(64) Country of origin
Genre varchar(20) Genre (e.g., action, drama)

πŸ” One Movie can have multiple Shows.


πŸ”΅ 2. Show

Represents a particular showtime of a movie in a specific hall.

Field Type Description
ShowID (PK) int Unique identifier
Date datetime Date of the show
StartTime datetime Start time
EndTime datetime End time
CinemaHallID (FK) int Which hall it's being shown in
MovieID (FK) int Which movie is being shown

πŸ” Each Show belongs to one Movie and one Hall, but a movie can have many shows.


πŸ”΅ 3. Booking

A customer booking one or more seats for a specific show.

Field Type Description
BookingID (PK) int Unique identifier
NumberOfSeats int How many seats were booked
Timestamp datetime When the booking was made
Status int (enum) Status: booked, cancelled, etc.
UserID (FK) int Who made the booking
ShowID (FK) int For which show

πŸ” One Booking belongs to one User and one Show.


πŸ”΅ 4. User

Represents a person using the system to book tickets.

Field Type Description
UserID (PK) int Unique identifier
Name varchar(64) User's name
Password varchar(20) Login password (likely hashed)
Email varchar(64) Email address
Phone varchar(16) Phone number

πŸ” One User can make multiple Bookings.


πŸ”΅ 5. Payment

Represents the payment made for a booking.

Field Type Description
PaymentID (PK) int Unique identifier
Amount number Amount paid
Timestamp datetime When the payment was made
DiscountCouponID int (Optional) coupon applied
RemoteTransactionID int External payment gateway reference
PaymentMethod int (enum) Enum like: Card, UPI, Wallet, etc.
BookingID (FK) int Linked booking

πŸ” Each Payment is linked to one Booking.


πŸ”΅ 6. Show_Seat

Represents a seat reserved for a particular show.

Field Type Description
ShowSeatID (PK) int Unique identifier
Status int (enum) Enum (available, booked, etc.)
Price number Dynamic price per seat
CinemaSeatID (FK) int Link to base seat
ShowID (FK) int For which show
BookingID (FK) int Which booking owns it (nullable)

πŸ” A Show_Seat is derived from a Cinema_Seat and linked to a Booking and Show.


πŸ”΅ 7. Cinema_Seat

Represents a physical seat in a hall.

Field Type Description
CinemaSeatID (PK) int Unique ID for the seat
SeatNumber int Seat number
Type int (enum) Enum: regular, recliner, etc.
CinemaHallID (FK) int In which hall

πŸ” Each seat belongs to a Cinema Hall.


πŸ”΅ 8. Cinema_Hall

Represents an individual hall inside a cinema.

Field Type Description
CinemaHallID (PK) int Unique ID
Name varchar(64) Hall name
TotalSeats int Number of seats
CinemaID (FK) int Which cinema it belongs to

πŸ” One Cinema can have many Halls.


πŸ”΅ 9. Cinema

Represents a cinema (like PVR, INOX).

Field Type Description
CinemaID (PK) int Unique ID
Name varchar(64) Cinema name
TotalCinemaHalls int Number of halls inside
CityID (FK) int Location city

πŸ” A city can have multiple Cinemas.


πŸ”΅ 10. City

Location metadata for the cinema.

Field Type Description
CityID (PK) int Unique city ID
Name varchar(64) City name
State varchar(64) State
ZipCode varchar(16) Postal code

πŸ” Summary of Relationships:

  • Movie ↔ Show: One-to-many
  • Show ↔ Booking: One-to-many
  • User ↔ Booking: One-to-many
  • Booking ↔ Payment: One-to-one
  • Show ↔ Show_Seat: One-to-many
  • Show_Seat ↔ Booking: Many-to-one (nullable)
  • Cinema ↔ Cinema_Hall: One-to-many
  • Cinema_Hall ↔ Cinema_Seat: One-to-many
  • City ↔ Cinema: One-to-many
  • Cinema_Hall ↔ Show: One-to-many

βœ… Use Case Example (Real Flow):

  1. A user logs in and selects a city.
  2. System shows cinemas in that city.
  3. User selects a cinema, chooses a movie and a showtime.
  4. Based on selected show, the system displays available seats from Show_Seat.
  5. User selects seats β†’ makes a booking β†’ payment is made and logged.
  6. Show_Seat.status is updated to booked and BookingID is attached.

Top comments (0)