From the course: MySQL Advanced Topics (2019)

Unlock this course with a free trial

Join today to access over 22,600 courses taught by industry experts.

About foreign keys

About foreign keys

- [Instructor] Foreign key constraints help guarantee referential integrity. This means that data in different tables is kept consistent. Foreign key constraints may prevent or propagate changes to related tables as needed to maintain consistency. In a relational database relationships between tables are maintained by one table referring to key columns in other tables. These relationships are called foreign keys. In this example, the sale table has a customer ID column, which refers to the ID column in the customer table. This connection is called a foreign key. In the foreign key relationship, the table with the reference is called the child table and the target of the reference is called the parent table. A foreign key constraint is used to maintain the integrity of the relational connection. The foreign key constraint is part of the table definition in the child table. The foreign key constraint requires an index. The…

Contents