Referential integrity
Referential integrity is the database property that references between related records correspond to valid existing keys or records.
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
- foreign keyimplemented by · A foreign key is a column or set of columns in a relational table whose values reference a candidate key in the same or another table, establishing a relationship and supporting referential integrity.
- soft deletionused by · Soft deletion is a technique that marks or hides data as deleted while retaining its physical representation for recovery or later permanent removal.
- primary keyproduced by · A primary key is a designated column or attribute, or combination of them, that uniquely identifies each row or item in a table or data store.
- ScyllaDBcontrasts with · ScyllaDB is a distributed wide-column database compatible with Cassandra’s data model and protocol, designed for high scalability and availability.
- databaseused by · A database is an organized collection of persistent data managed by software for storage, retrieval, querying, and modification.
- referenceuses · A reference is an indirect value or relationship that identifies or provides access to another value, object, resource, or source.
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.



