Example scenario.
In a flight schedule system, there are a pilot table which refers to a plane_type table indicating the planes the pilot is able to fly (assuming that is a many-to-one relation).
There are also a plane table and it refers to the plane_type table to indicate the plane’s type
(also many-to-one relation).
Now there is an associative table flight_plan which assigns a pilot to a plane for a given flight.
How do I make sure the pilot‘s qualification do match the plane‘s type for this flight?
Any possibility to implement this as a constraint in a database design? Thank you.
Edited:
Refering to the diagram below, how to make sure pilot.plane_type is equal to plane.plane_type?
Planehas unique index (AK) onPlaneID, PlaneTypeIDEDIT