Skip to main content

What is a Foreign Key and what problem does it solve?

Entry MS SQL
Quick Answer A foreign key in one table points to the primary key in another table. It enforces referential integrity รขโ‚ฌโ€ you can't add an order for a customer that doesn't exist. It's how relational databases maintain relationships between entities without duplicating data.

Answer

A foreign key creates a relationship between tables and prevents orphaned or invalid data by enforcing referential integrity.

S
SugharaIQ Editorial Team Verified Answer

This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.

Want to bookmark, take notes, or join discussions?

Sign in to access all features and personalize your learning experience.

Sign In Create Account

Source: SugharaIQ

Ready to level up? Start Practice