Back to Developer Roadmap

Foreign Key

src/data/question-groups/sql/content/foreign-key.md

4.0497 B
Original Source

A foreign key is a column (or a combination of columns) that references the primary key of another table. It's used to establish a relationship between two tables, helping maintain referential integrity and ensuring data integrity by making sure the linked data stays consistent across both tables.

A table with a foreign key constraint helps prevent unmatched records and keeps data consistent across related tables.