Concept:
Data integrity ensures that the data in a database is accurate, consistent, and reliable. There are three main types of integrity constraints in the relational model: Entity, Referential, and Domain.
Step 1: Defining Referential Integrity.
Referential integrity is a property of data stating that any value in one table that refers to another table must exist in that other table. This is the cornerstone of relationships between tables (e.g., a "Customer ID" in the "Orders" table must exist in the "Customers" table).
Step 2: The Role of the Foreign Key.
A Foreign Key is a field (or collection of fields) in one table that uniquely identifies a row of another table. By defining a column as a Foreign Key, the DBMS automatically checks that:
• No "dangling pointers" are created (you can't add an order for a customer that doesn't exist).
• You can't delete a parent record if child records still exist (unless "Cascade Delete" is enabled).
Step 3: Distinguishing other Integrities.
• Entity Integrity: Enforced by the Primary Key (no nulls, no duplicates in the PK column).
• Domain Integrity: Enforced by data types, ranges, and "Check" constraints (e.g., Age must be $> 0$).