Question: Consider the schema: EMP (eid:integer, ename


Consider the schema:

EMP (eid:integer, ename:string, age:integer, salary:real)
Works (eid:integer, did:integer, pct-time:integer)
Dept (did:integer, dname:string, budget:real, manager_id:integer)

Specify the number of possible foreign keys in the above schema.

TarGate tar_gate 13 Oct 2014 10:12 pm

In the works relation, eid and did seems to be foreign keys from EMP and Dept relation. Also in the Dept relation manager_id seems to be the foreign key from EMP (eid). So total possible foreign keys as per me are 3.

kaushal kaushalmaurya 13 Oct 2014 09:43 pm

I think only eid and did is foreign keys from EMP and Dept relation. so, total no of foreign  keys are 2.

yogesh kumar yogesh42 13 Oct 2014 10:15 pm

plz explain for manager-id ??

TarGate tar_gate 14 Oct 2014 09:19 pm

Assuming that for every department there is a manager, and as the manager is also an employee and has his own eid, the manager_id field of Dept can serve as the foreign key for eid of EMP relation.