Britannica Sources used in this answer

How does referential integrity prevent invalid references in a database?

Created from Britannica articles using AI. AI can make mistakes, so verify using Britannica articles.

Referential integrity is a critical component of data integrity within a database. It functions by enforcing a rule that ensures every entity referenced by another entity must exist within the database system.1

By requiring that a reference points to a valid, existing record, the system prevents the creation of "orphaned" or invalid references. For example, if a user attempts to book an airline reservation for a specific flight number, the database management system (DBMS) checks to ensure that the flight referenced by that number actually exists in the database records. If the flight does not exist, the system will reject the entry, thereby maintaining the correctness and stability of the data.1