📞 0339-0387701 (WhatsApp) Contact

« Back to Database & Data Handling (NCCIA)

Can a foreign key also be a primary key?

A. No, only in parent tables
B. No, never
C. Yes, in every table
D. Yes, in a one-to-one relationship or a junction table, a foreign key can be part or all of the primary key ✅

Correct Answer: D. Yes, in a one-to-one relationship or a junction table, a foreign key can be part or all of the primary key

Explanation

In a junction table the composite primary key is made of foreign keys, and in a one-to-one link the foreign key can also be the primary key.