Question:medium

Which of the following ensures referential integrity in a relational database?

Show Hint

Think of integrity rules: Entity Integrity is enforced by Primary Keys (unique, not null). Referential Integrity is enforced by Foreign Keys (values must match a primary key in another table or be null).
Updated On: Jul 2, 2026
  • Primary Key
  • Foreign Key
  • Index
  • View
Show Solution

The Correct Option is B

Solution and Explanation

Step 1: Understand what referential integrity is protecting.
Referential integrity means that a value in one table which is supposed to point to a row in another table must actually point to a row that exists, no dangling references allowed.
Step 2: See which constraint enforces exactly this rule.
A foreign key is a column, or set of columns, in one table that references the primary key of another table. The database engine checks every insert and update against this constraint, and it also controls what happens on deletes in the parent table, so an order can never point to a customer that does not exist.
Step 3: Compare with the other options.
A primary key only guarantees uniqueness and non null values within its own table, it says nothing about relationships to other tables. An index is purely a performance structure for faster lookups, and a view is just a saved query, neither enforces any cross table rule.
Step 4: Conclude.
The constraint responsible for maintaining valid cross table references is the
\[ \boxed{\text{Foreign Key}} \]
Was this answer helpful?
0