The declarative constraints are defined using the DDL statements CREATE TABLE and ALTER TABLE. They can be column-level constraints or table-level constraints. Column-level constraints, together with the data type and other column properties, are placed within the declaration of the column, while table-level constraints are always defined at the end of the CREATE TABLE or ALTER TABLE statement, after the definition of all columns.
Note: There is only one difference between column-level constraints and table-level constraints: a column-level constraint can be applied only upon one column, while a table-level constraint can cover one or more columns of a table.
All declarative constraints can be categorized into several groups:
-
DEFAULT clause
-
UNIQUE clause
-
PRIMARY KEY clause
-
CHECK clause
-
FOREIGN KEY clause and referential integrity