referential integrity
The guarantee that every foreign key value points at a row that really exists.
In more detail
Without it, deleting a customer can leave orders pointing at nobody, a dangling reference. Foreign key constraints enforce it inside the database, for every program that writes, which an application-level check cannot do.
Related terms
- foreign key — A column holding another table's primary key value, which the database guarantees points at a row that exists.
- constraint — A rule the database enforces on stored data, such as a column that must be unique or not null.
- referential action — The rule, declared on a foreign key, for what happens to child rows when the parent row they point at is deleted or changed.
Taught in
- Why Tables And Relations Beat Files — PostgreSQL, Indexing & Relational Data Modeling
- Keys, Constraints And Referential Integrity — PostgreSQL, Indexing & Relational Data Modeling