Referential integrity
The relational database rule that every foreign key value must match an existing key in the referenced table, or be null, so no row points to a record that does not exist.
Referential integrity is one of the integrity rules of the relational model. It requires that every value in a foreign key column either matches an existing key value in the table it references or is null. An order naming a customer who does not exist is an orphan. A database management system enforces the rule through foreign key constraints, and the designer chooses what happens when a referenced row is deleted or changed: reject the change, cascade it to the dependent rows, or set their foreign keys to null.
It sits beside entity integrity, which requires every primary key to be unique and not null. Together these rules are part of the consistency that transactions preserve under ACID. The security interest is integrity of stored data, and also leakage in multilevel databases: an error caused by a hidden record, such as a refused delete because a classified row still refers to it, can reveal that the record exists. Polyinstantiation complicates the rule across classification levels.
Exam relevance: a scenario describing orphaned records, or a foreign key pointing at nothing, is likely to point to referential integrity, while duplicate or empty primary keys point to entity integrity. Candidates are expected to keep the two rules apart and to link them to the primary and foreign keys they govern.