sql - Primary Key in three tables -
just curious if can have same primary key in 3 different tables? going create employee, fulltime , parttime tables. make employeeid primary key 3. thoughts?
you can have primary key employeeid
in table called employees
. have common information, such date of hire , on.
then, each of subtables can have employeeid
both primary key in table and foreign key reference employees.employeeid
. 1 way implement one-of relationship using relational tables.
unfortunately, unless use triggers, mechanism doesn't prevent 1 employee being in 2 other tables, not part of question.
Comments
Post a Comment