liveBook · Manning

Referential integrity

Referential integrity is the property that references between related data records or relations correspond to valid, existing keys or records.

How 4 Manning books explain it

Build Financial Software with Generative AI (From Scratch)

Referential integrity is a database property that requires references between related records to remain valid and prevents references to nonexistent records.

How it is used
Uses referential integrity to keep related ACH file records consistent in a relational database.
How deep it goes
Works through foreign keys, cascade rules, and test changes, including errors exposed by a schema revision.
Examples
Uses ACH file and record tables, a batch hierarchy, and failing insertion tests to illustrate relationships.
What you can do after
Apply it via PostgreSQL by defining foreign keys and cascade rules and updating test setup for valid parent records.

Read how Build Financial Software with Generative AI (From Scratch) explains referential integrity →

Grokking Relational Database Design

The property that references between related tables remain valid and consistent as rows are inserted, updated, or deleted.

How it is used
Protects related-table data during inserts, updates, and deletions with foreign key constraints.
How deep it goes
Defines parent-child validation, constraint naming, mandatory relationships, and update/delete actions including RESTRICT, CASCADE, and SET NULL.
Examples
Uses product-review, user-review, and payment-method-user table relationships, including rejected invalid review insertion.
What you can do after
Build it from scratch with named FOREIGN KEY ... REFERENCES constraints and appropriate update/delete actions.

Read how Grokking Relational Database Design explains referential integrity →

API Design Patterns

Referential integrity is the property that references remain valid and continue to identify the intended existing resources or data.

How it is used
Defines how APIs behave when resources referenced by other resources are deleted, moved, copied, or soft-deleted.
How deep it goes
Compares four deletion policies and explains write avalanches, deletion cascades, dangling pointers, moves, and soft-deletion consistency.
Examples
Uses MessageReviewReport.messageId, moved Message and ChatRoom resources, and four standardized deletion behaviors.
What you can do after
Evaluate deletion and movement policies, then configure API behavior that either restricts references or deliberately leaves them for consumers.

Read how API Design Patterns explains referential integrity →

100 SQL Server Mistakes and How to Avoid Them

Referential integrity is the property that relationships between tables contain only references to existing valid key values.

How it is used
Prevents invalid references between related tables during schema design and everyday data changes.
How deep it goes
Defines the property, demonstrates its failure, and shows repair and constraint-creation SQL without descending into constraint internals.
Examples
Uses Employees and Offices, plus MagicChoc purchase-order headers and details, to demonstrate valid and invalid references.
What you can do after
Operate/configure relational schemas by repairing invalid values and adding foreign key constraints with T-SQL.

Read how 100 SQL Server Mistakes and How to Avoid Them explains referential integrity →

Also covered in

What to know first

Related concepts

Questions about referential integrity

What is referential integrity?

Referential integrity is the property that references between related data records or relations correspond to valid, existing keys or records.

Which Manning books explain referential integrity?

Build Financial Software with Generative AI (From Scratch), Grokking Relational Database Design, API Design Patterns and 100 SQL Server Mistakes and How to Avoid Them.

What should I know before learning referential integrity?

Manning books that teach referential integrity usually introduce missing value, data integrity, foreign key and SQL first.

What is the difference between referential integrity and ScyllaDB?

Referential integrity is the property that references between related data records or relations correspond to valid, existing keys or records. ScyllaDB is a distributed wide-column database compatible with Cassandra’s data model and protocol, designed for high scalability and availability.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.