Referential integrity (RI) is defined as all the following notions.
- The concept of relationships between tables, based on the definition of a primary key (or UNIQUE alternate key) and a foreign key.
- A mechanism that provides for specification of columns within a referencing table that are foreign keys for columns in some other referenced table.
Referenced columns must be defined as Primary key columns or Unique columns.
- A reliable mechanism for preventing accidental database corruption when performing inserts, updates, and deletes.
Referential integrity requires that a row having a value that is not null for a referencing column cannot exist in a table if an equal value does not exist in a referenced column.