Note that there are some explanatory texts on larger screens.

plurals
  1. POdatabase supertype/subtype
    primarykey
    data
    text
    <p>I need to implement a database to track a parcel's location.</p> <p>There can be basically 4 locations, namely on a aeroplane, on a ship, on a car, at a transit office.</p> <p>I need to have separate entities for these 4 locations because they all have mutiple instances of each (e.g. many aeroplanes, many cars)</p> <p>Also, each of these 4 entities are managed by one and only one employee (another entity).</p> <p>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.</p> <p>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.</p> <p>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.</p> <p>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..</p> <p>EMPLOYEE [ <strong>employee_id</strong>, employee_name, gender, contact_number, job_scope ]</p> <p>JOB [ <strong>job_id</strong>, (employee_id), (location_id) ]</p> <p>OFFICE [ <strong>location_id</strong>, office_id, address ]</p> <p>CAR [ <strong>location_id</strong>, vehicle_id ]</p> <p>AEROPLANE [ <strong>location_id</strong>, vehicle_id, type, unladen_weight ]</p> <p>SHIP [ <strong>location_id</strong>, vehicle_id, size ]</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload