What is Foreign Key?
A column that creates a link between two tables by referencing the primary key of another table.
Foreign keys enforce referential integrity — ensuring relationships between tables remain consistent. For example, an orders table might have a customer_id foreign key referencing the customers table.
Foreign key constraints can specify behavior on delete/update: CASCADE (propagate changes), SET NULL, SET DEFAULT, or RESTRICT (prevent action). They are fundamental to relational database design.