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 the parent.
Common Mistakes to Avoid
- Thinking FK creates data
- Ignoring cascade rules
- Confusing with primary key
Practice This Question with AI
Answer this question orally or via text and get instant AI-powered feedback on your response quality, structure, and delivery.
Related Interview Questions
What is the difference between LIKE and equals operators in SQL?
Easy
TCSWhat is the difference between UNION and UNION ALL?
Easy
Describe a PRIMARY KEY and how it differs from a UNIQUE key
Medium
What is ER model in the DBMS?
Medium
FlipkartWhat is Join and explain its types?
Medium
FlipkartWhat is the ER model in DBMS?
Easy
Flipkart