rolladice
rolladice

Reputation: 77

Can primary key in one table appear in another table as primary key as well?

I'm sorry for the rather stupid question. For example, can one table have composite primary key consisting of 'user_id' and 'employee_id'

and another table containing 'user_id' as primary key?

Upvotes: 2

Views: 1487

Answers (1)

Juan Carlos Oropeza
Juan Carlos Oropeza

Reputation: 48177

Short Answer: YES, in that case you have one-to-0/1 relationship

For example table USERS have PK user_id

Then table SUPERUSERS have also PK user_id and is also FK to users. Not all users are superusers, and you need define some attributes/roles/privilege to superusers.

Upvotes: 4

Related Questions