Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- create table flights(
- flight_id int(11) primary key,
- departure_time datetime not null,
- arrival_time datetime not null,
- `status` varchar(9) not null
- check(`Status`= 'Departing' or`Status`='Delayed' or`Status`='Arrived' or`Status`= 'Cancelled'),
- origin_airport_id int(11) not null,
- destination_airport_id int(11) not null,
- airline_id int(11) not null,
- CONSTRAINT fk_flights_airport_origin FOREIGN KEY(origin_airport_id) REFERENCES airports(airport_id),
- CONSTRAINT fk_flights_airport_destination FOREIGN KEY(destination_airport_id) REFERENCES airports(airport_id),
- CONSTRAINT fk_flights_airline FOREIGN KEY(airline_id) REFERENCES airlines(airline_id)
- );
- create table tickets(
- ticket_id int(11) primary key,
- price decimal(8,2) not null,
- class varchar(6) not null check(Class='First' or Class='Second' or Class='Third'),
- seat varchar(5) not null,
- customer_id int(11) not null,
- flight_id int(11) not null,
- CONSTRAINT fk_tickets_customer FOREIGN KEY(customer_id) REFERENCES customers(customer_id),
- CONSTRAINT fk_tickets_flight FOREIGN KEY(flight_id) REFERENCES flights(flight_id)
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement