• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1138
  • Last Modified:

Can a PK be an FK as well ?


Can a PK be an FK as well ?

Thank you.
2 Solutions
foreign key of one table is the primary key of another table.
For the field to be the primary key of table A and the foreign key of table B ... No. Foreign key needs to take the values from table B.
yes a pk can be an fk - however this must be done in a special way. The trick is you must have two foreign keys that then composite into a Primary key - this is useful for when tables would otherwise have a many to many relationship you can put an intermediary table in between them and use the PK from each primary table as an FK in the intermediary table thereby creating a one to many - int table - many to one relationship.

Personally I dislike this method and always give the intemediary table a primary key and then add the two FK's thus making sure every single record in every single table is unique
matthew016Author Commented:
The answer was just yes, no special way needed
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now