Previous Topic

Next Topic

Types of Integrity Constraints

Integrity constraints can be of the following types:

  • Check constraints
  • Primary key specification
  • Candidate key specification
  • Referential constraints

An integrity constraint can optionally be referred to by its name. The following example shows the specification of the constraint name, prim_constr, on the supplier_item table:

CREATE TABLE supplier_item (
     supp_no        INTEGER NOT NULL,
     item_no        INTEGER NOT NULL,
     qty            INTEGER NOT NULL DEFAULT 0
     CONSTRAINT prim_constr
     PRIMARY KEY (supp_no, item_no)
) ;

In the above example, note that the constraint name is specified using the keyword, CONSTRAINT.

The following sections give more information on various types of constraints.