IdeasCuriosas - Every Question Deserves an Answer Logo

In Computers and Technology / College | 2025-07-03

Out of 4 now
For the following relational schema:
Where would you define the foreign keys for
each table? Explain your reasoning
AIRPORT
Airport code Name City State
FLIGHT
Flight_number Airline Weekdays
FLIGHT_LEG
Flight number
Leg_number
Departure airport code
Scheduled_departure_time
Arrival airport code
Scheduled_arrival_time
LEG INSTANCE
Flight_number Leg_number
Departure airport code
Date
Number_of_available_seats
Airplane_id
Departure_time
Arrival airport code
Arrival_time
FARE
Flight_number
Fare_code Amount Restrictions
AIRPLANE TYPE
Airplane_type_name
Max seats
Company
CAN_LAND
Airplane_type_name
Airport code
AIRPLANE
Airplane_id
Total_number_of_seats
SEAT RESERVATION
Flight number
Airplane_type
Leg number
Date
Seat number
Customer_name
Customer_phone

For the following relational schema:
Where would you define the foreign keys for each table? Explain your reasoning

Asked by vaddellisrijachowdar

Answer (2)

Foreign keys should be defined in the child tables (such as FLIGHT_LEG, LEG_INSTANCE, FARE, CAN_LAND, AIRPLANE, and SEAT_RESERVATION) to reference the primary keys of their related parent tables, ensuring referential integrity in the database schema. ;

Answered by SophiaElizab | 2025-07-07

Foreign keys in the schema should be placed in child tables that reference primary keys in parent tables, ensuring data integrity. The key relationships involve linking flight legs, instances, fares, airplanes, and reservations to their respective tables. This structure maintains valid and consistent data across the database.
;

Answered by SophiaElizab | 2025-07-09