# Referential Integrity

*noun*

say it: **“ref-uh-REN-shul in-TEG-rih-tee”** **/ˌrɛfəˈrɛnʃəl ɪnˈtɛɡrɪti/**

The rule that every foreign key in a table points at a row that really exists, so no row is left pointing at nothing.

## What is **Referential Integrity** in a relational database?

**Referential Integrity** — The rule that foreign-key values must reference an existing allowed key or be NULL when permitted.

```sql
CREATE TABLE purchase_order (
    order_id INTEGER PRIMARY KEY,
    customer_id INTEGER REFERENCES customer (customer_id)
);
```

## In a sentence

- “**Referential integrity** stopped a product from naming vendor 99, who doesn't exist.”
- “Turning on foreign keys in SQLite is what enforces **referential integrity**.”

Level: Journeyman · [More Database terms at this level](https://www.ask-codey.com/glossary?category=database&level=3)

Updated: November 19, 2026

Source: https://www.ask-codey.com/glossary/referential-integrity
