FOREIGN KEY CONSTRAINT
A FOREIGN KEY constraint in SQL is a rule that establishes a relationship between two tables by ensuring the referential integrity of the data. It defines a column in one table as a foreign key that references the primary key in another table. This relationship allows you to maintain consistency and integrity when working with data across multiple tables in a relational database.
- The table with the foreign key is called the child table.
- The table with the primary key is called the referenced or parent table.