liveBook · Manning

Referential integrity

Referential integrity is the database property that references between related records 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 relational constraints to keep uploaded ACH files and their parsed records consistently connected.
How deep it goes
Works through foreign keys, cascades, schema refactoring, and resulting unit-test failures rather than only defining the term.
Examples
Uses ACH file, batch, entry, addenda, and control records plus ach_files and ach_records tables.
What you can do after
Build it from scratch by defining foreign-key relationships and adapting tests to require 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 →

Related concepts

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.