📞 0339-0387701 (WhatsApp) Contact

« Back to Database & Data Handling (NCCIA)

Can a foreign key reference a UNIQUE column instead of a primary key?

A. No, only primary keys can be referenced
B. Yes, if the column is unique and not null ✅
C. Yes, any column can be referenced
D. No, only composite keys can be referenced

Correct Answer: B. Yes, if the column is unique and not null

Explanation

SQL allows a foreign key to reference any candidate key, which includes a UNIQUE column, because it still identifies one parent row.