FOREIGN KEY Constraint
Learn FOREIGN KEY Constraint (Constraints, MySQL) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.
Introduction A FOREIGN KEY makes a column (or set of columns) in a child table refer to the primary or unique key of a parent table. The engine then guarantees every child value either matches an existing parent row or is NULL. This rule is called referential integrity. Only InnoDB enforces it.