CREATE TABLE reservations (
reservation_id INT PRIMARY KEY AUTO_INCREMENT,
train_id INT,
passenger_id INT,
reservation_date DATETIME NOT NULL,
FOREIGN KEY (train_id) REFERENCES trains (train_id),
FOREIGN KEY (passenger_id) REFERENCES passengers(passenger_id)
);
CREATE TABLE seat_reservations (
seat_reservation_id INT PRIMARY KEY AUTO_INCREMENT,
reservation_id INT,
seat _number INT NOT NULL,
is_reserved BOOLEAN NOT NULL DEFAULT FALSE,
FOREIGN KEY (reservation_id) REFERENCES reservations(reservation_id)
);
Trains
| train_id (PK)
train_name 41
+
| departure_station |
| arrival_station |
| departure_time |
| arrival_time 46 | total_seats
| Passengers
| passenger_id (PK)|
first_name
| last_name
email
I phone_number
| Reservations |
| reservation_id(PK) |
| train_id (FK) |
| passenger_id (FK) | I
| reservation_date |
Seat_Reservations |
To embed this project on your website, copy the following code and paste it into your website's HTML: