Advertisement
Guest User

first

a guest
Feb 24th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1.  
  2. create table flights(
  3. flight_id int(11) primary key,
  4. departure_time datetime not null,
  5. arrival_time datetime not null,
  6. `status` varchar(9) not null
  7. check(`Status`= 'Departing' or`Status`='Delayed' or`Status`='Arrived' or`Status`= 'Cancelled'),
  8. origin_airport_id int(11) not null,
  9. destination_airport_id int(11) not null,
  10. airline_id int(11) not null,
  11. CONSTRAINT fk_flights_airport_origin FOREIGN KEY(origin_airport_id) REFERENCES airports(airport_id),
  12. CONSTRAINT fk_flights_airport_destination FOREIGN KEY(destination_airport_id) REFERENCES airports(airport_id),
  13. CONSTRAINT fk_flights_airline FOREIGN KEY(airline_id) REFERENCES airlines(airline_id)
  14. );
  15.  
  16.  
  17.  
  18. create table tickets(
  19. ticket_id int(11) primary key,
  20. price decimal(8,2) not null,
  21. class varchar(6) not null check(Class='First' or Class='Second' or Class='Third'),
  22. seat varchar(5) not null,
  23. customer_id int(11) not null,
  24. flight_id int(11) not null,
  25. CONSTRAINT fk_tickets_customer FOREIGN KEY(customer_id) REFERENCES customers(customer_id),
  26. CONSTRAINT fk_tickets_flight FOREIGN KEY(flight_id) REFERENCES flights(flight_id)
  27. );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement