Next: Relational Rules
Up: RELATIONAL MODEL OF DATA
Previous: Sample Database Instance
Integrity Constraints are conditions that must be satisfied by
the database at all times. Some commonly used Integrity Constraints
are:
- not null: Certain columns in a table may be prohibited
from having null values.
- primary key: is a set of column names which uniquely
identify each row.
Example: {CID} is the primary key for
customers table.
The primary key constraint indicates that
the table cannot contain two different rows with the
same values under primary key columns.
- candidate key: A relation (table) may contain more
than one key.
In this case, one of the keys is selected
as the primary key and the remaining keys are called
candidate keys.
The candidate key constraint indicates that
the table cannot contain two different rows with the
same values under candidate key columns. - foreign keys (referential integrity): Many a times,
it is necessary to include column names from one table in
another table.
Example: CID, AID and PID are included
in the orders table.
CID is a primary key of the customers table
and its inclusion in the orders table makes it a foreign key in the
orders table.
This constraint forces every CID value in the
orders table to be also present in the customers table.
Raj Sunderraman
Tue Apr 1 16:15:10 PST 1997