Explain foreign keys and referential integrity
This question tests relationship enforcement. It evaluates data consistency strategies.
Why Interviewers Ask This
Foreign keys prevent orphaned data. Interviewers check if you understand how relationships are enforced automatically.
How to Answer This Question
Define FK as a column referencing a parent key. Explain it prevents orphan rows. Mention actions on delete/update.
Key Points to Cover
- References parent key
- Prevents orphan rows
- Enforces integrity
- Child-Parent relationship
Sample Answer
A foreign key is a column in a child table that references a primary key in a parent table. It enforces referential integrity by preventing actions that would create orphan rows, ensuring child values actually exist in t…
Common Mistakes to Avoid
- Thinking FK creates data
- Ignoring cascade rules
- Confusing with primary key
Sound confident on this question in 5 minutes
Answer once and get a 30-second AI critique of your structure, content, and delivery. First attempt is free — no signup needed.