Try OpenEdge Now
skip to main content
SQL Development
OpenEdge SQL Data Definition Language : Maintaining data integrity : Types of integrity constraints
 

Types of integrity constraints

SQL provides four types of integrity constraints:
*Check constraints:
*Column-level check constraint
*Table-level check constraint
*Primary key specifications
*Candidate key specifications
SQL allows you to specify an integrity constraint, and to refer to that constraint in other SQL statements. The database assigns a constraint name if you do not specify one.
The following example shows the assignment of table constraint prim_constr on table supplier_item. You specify a constraint name with the CONSTRAINT keyword.
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)
) ;
* Check constraints
* Column-level check constraints
* Table-level check constraints
* Primary keys
* Candidate keys