I need to implement a database to track a parcel's location.
There can be basically 4 locations, namely on a aeroplane, on a ship, on a car, at a transit office.
I need to have separate entities for these 4 locations because they all have mutiple instances of each (e.g. many aeroplanes, many cars)
Also, each of these 4 entities are managed by one and only one employee (another entity).
I have created an associative entity called job whereby it stores the information about which employee working in each of the 4 locations, similar to a flight number which contains the aeroplane id with the pilot id.
I have examined the attributes of the 4 locations, and found that they could be classified into car being the supertype and aeroplane, ship and office being subtype of car.
there would be a unique attribute of location_id which tells me whether it is on an aeroplane or an office in the supertype, thus the subtype would inherit this attribute.
my question is whether in the tables design, since locations will be separated into four different tables, whenever i referred location_id(FK) from the job entity, is it still possible to do so since a foreign key normally links to only one table and not 4 tables in this case..
EMPLOYEE [ employee_id, employee_name, gender, contact_number, job_scope ]
JOB [ job_id, (employee_id), (location_id) ]
OFFICE [ location_id, office_id, address ]
CAR [ location_id, vehicle_id ]
AEROPLANE [ location_id, vehicle_id, type, unladen_weight ]
SHIP [ location_id, vehicle_id, size ]