📞 0339-0387701 (WhatsApp) Contact

« Back to Database & Data Handling (NCCIA)

What is the main purpose of a foreign key in a relationship?

A. To store a copy of the parent data
B. To replace the primary key
C. To make the child table independent
D. To enforce the link between tables and preserve referential integrity, not merely to store a value ✅

Correct Answer: D. To enforce the link between tables and preserve referential integrity, not merely to store a value

Explanation

A foreign key is a constraint as well as a column: it guarantees the referenced parent exists and defines what happens on change or delete.