Data integrity tools

To help maintain data integrity, you can use data constraints and constraints that specify the referential structure of the database.

Constraints

You can use several types of constraints on the data in individual columns or tables. For example:

These and other table and column constraints are discussed in “USING table and column constraints”. Column constraints can be inherited from user-defined data types.

Entity and referential integrity

The information in relational database tables is tied together by the relations between tables. These relations are defined by the candidate keys and foreign keys built into the database design.

A foreign key is made up of a column or a combination of columns. Each foreign key relates the information in one table (the foreign table) to information in another (referenced or primary) table. A particular column, or combination of columns, in a foreign table is designated as a foreign key to the primary table.

The primary key or column (or set of columns) with a unique constraint is known as a candidate key. The referenced column or set of columns must be a candidate key and is called the referenced key.

The following restrictions affect candidate keys:

The following integrity rules define the structure of the database:

For more information about referential integrity, see “Declaring entity and referential integrity”.