What Is Referential Integrity?

Referential integrity, also known as RI for short, is a system that ensures that relationships between tables remain valid. Consider the classic example of orders and order line items. For every order, you can have one or more line items. Based on what you have learned thus far, you know this is a one-to-many relationship. You also know that carrying the primary key of the order in the order line item records facilitates the relationship. The inference of the last sentence is that if you don’t have an order, you cannot have an order line item. The question then is “How do you enforce the rules that exist between tables?” The answer is to create what are known as RI constraints. Although databases such as Access ...

Get Absolute Beginner’s Guide to Databases now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.