Aircraft PK AircraftiD: Int Pilots PK PilotID: Int AircraftType char(4) TailNumb
ID: 3751946 • Letter: A
Question
Aircraft PK AircraftiD: Int Pilots PK PilotID: Int AircraftType char(4) TailNumber char(6) PassengerCapacity: Int RangelnMiles float Flights PK FlightlD: int FK PilotinCharge: Int FK AirplanelD: Int FirstName char(30) LastName char(50) HireDate: date Aircraft AircraftlD 101 102 103 AircraftType C310 C310 C340 TailNumber N1112 N0097 N0023 PassengerCapacity RangelnMiles 4 3 8 1000 1000 1528 Pilots PilotID 12 15 23 FirstName Sarah John Mike LastName O'Conner Chiu Holcomb HireDate 2012-04-12 2014-09-22 2016-11-11 Flights FlightID 1942 1943 1944 1945 PilotInCharge 12 12 15 23 AirplaneID 103 101 101 102Explanation / Answer
Answer)
In the database table structure, we have the AircraftID as the primary key of the table - Aircraft. The Flights table has the AirplaneID as the foreign key which references to AircraftID. Flights table has the PilotInCharge as the foreign key which references to PilotID in the Pilot.
Now for every parent/child relationship in the database:
When enforcing cascading update operations:
ON UPDATE CASCADE if we update AircraftID or PilotID in the parent tables, then the values will be updated in the Flights table also accordingly. There is also an option where in using ON UPDATE SET NULL we can set those child values to null.
When enforcing cascading delete operations:
ON DELETE CASCADE if we use cascading delete operations, the child row will be deleted as well as the parent row will be deleted. ON DELETE SET NULL the child row will be set null when you delete a parent row.
The Pilots table will have no changes as it references only the FlightID and thus there is no problem.
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.