Skip to main content

What is a foreign key?

Entry MySQL
Quick Answer Foreign key links one table to another, enforcing referential integrity. The FK column in the child table must match a value in the referenced (parent) table's primary/unique key or be NULL. InnoDB enforces FK constraints on INSERT, UPDATE, and DELETE. ON DELETE CASCADE, ON DELETE SET NULL, or ON DELETE RESTRICT control behavior when the parent row is deleted.

Answer

A foreign key is a column that references a primary key in another table, enforcing referential integrity between related tables.
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