Referential integrity terms

 

A discussion of referential integrity requires an understanding of several terms. These terms are arranged in an order that might help you understand their relationship to each other.

Primary key constraint

A field or set of fields in a database file that must be unique, ascending, and cannot contain null values. The primary key is the primary file access path. The primary key constraint can be used as the parent key when adding a referential constraint. A primary key constraint is really a unique constraint with some special attributes.

Unique constraint

A field or set of fields in a database file that must be unique, ascending, and can contain null values.

Parent key

A field or set of fields in a database file that must be unique, ascending, and might or might not contain null values. The parent key of the parent file is used to add a referential constraint to the dependent file. The parent key must be either a primary key or a unique constraint.

Foreign key

A field or set of fields in which each non-null value must match a value in the parent key of the related parent file.

The attributes (data type, length, and so forth) must be the same as the parent key of the parent file.

Parent file

The file in a referential constraint relationship that contains the parent key.

Dependent file

The file in a referential constraint relationship that contains the foreign key. The dependent file is dependent on the parent file. That is, for every non-null value in the foreign key of the dependent file, there must be a corresponding non-null value in the parent key of the parent file.

Check pending

The state that occurs when the database does not know with certainty whether for a referential constraint this is true: for every non-null value in the foreign key of the dependent file, there must be a corresponding non-null value in the parent key of the parent file.

Delete rule

A definition of what action the database should take when there is an attempt to delete a parent record.

Update rule

A definition of what action the database should take when there is an attempt to update a parent record.

 

Parent topic:

Ensuring data integrity with referential constraints