Integrity Constraints

Integrity Constraints

PRIMARY KEY

The primary key constraint uniquely identifies each record. Primary keys must contain unique values and cannot contain NULL values.

FOREIGN KEY

The foreign key constraint is used to prevent actions that would destroy the links between tables. A foreign key is a field in one table that refers to the primary key of another table.

NOT NULL

The not null constraint is used to ensure that a given column of the table is never assigned a null value. It forces the column not to accept null values.

DEFAULT

The default constraint is used to set a default value for a column. The default value is added to new records if no value is specified.

CHECK

If we define a check constraint on a column it allows only certain values for this column. It limits the number of values.

UNIQUE

It ensures all values in a column are different.