What is Database Referential Integrity?

Referential Integrity is an important feature within an application database design. Referential Integrity refers to the ability of the database to keep related data from being corrupted. The data references between tables must remain intact. For example in the Personnel System demonstration application database, all of the records in the Section table require a Department Code. These Department Codes must exist in the Department table. If this reference is lost, the database is considered to be corrupted and referential integrity is broken.

Referential Integrity means that two specific database rules must exist between tables:

1.  Do not delete data required by another table.
You must check that there are no records in related tables that require the record which you are deleting.

2.  Do not add incomplete data to a table.
You must check that the related information exists in another table before adding information to a table.

These two rules describe data dependencies from the perspective of each table involved in the relationship. Referential integrity works in two directions and is sometimes described as "forward" and "backward" referential integrity. This concept is similar to access routes.  Table1 has a relationship to Table2, and Table2 has a relationship to Table1. In order to build referential integrity into your database, you must have a good understanding of the application business rules.

LANSA implements database referential integrity using table rules in the Repository so that your application is independent of the database used. Independence is a major advantage when deploying your application.

Also See

Referential Integrity Example