Table-level constraints specify sets of relationships among values within a row. A table-level constraint can be either single-row or multirow, and applies to table columns rather than table rows.
For example, you can specify a table constraint on the flight_reservations table (see How Relational Databases Are Built from Logical Propositions) that requires the value for the scheduled arrival date, a_date, to be less than or equal to the value for the scheduled departure date, d_date. This is a single-row table constraint.
The SQL definition for this constraint looks like this:
CONSTRAINT arrive_date_check CHECK (a_date >= d_date)
This constraint refers to two columns, a_date and d_date; therefore, must be a table constraint.
You want to make sure the value for res_num is unique and non-null, so you define a uniqueness constraint on the table for reservation numbers. res_num is the primary key for the flight_reservations table, so the constraint is called a primary key constraint.
The SQL definition looks like this.
res_num INTEGER NOT NULL CONSTRAINT pKey PRIMARY KEY
Primary key constraints are a subset of uniqueness constraints: all primary keys are also unique, but all unique columns are not primary keys because a relation can only have one primary key. Because any unique column set is, by definition, also a candidate key, uniqueness constraints are also called key constraints. The primary key constraint on res_num is also a multirow table constraint because the primary key enforces the rule that every row in the table has at least one unique value: its reservation number.
Suppose reservation number is not the primary key for the flight_reservations table, but your business rules require the values for res_num to be unique. To do this, you write a constraint that enforces uniqueness on the res_num column. The SQL definition looks like this:
res_num INTEGER NOT NULL CONSTRAINT ResNumUnique UNIQUE
The table constraints for your databases are developed from the ATM Constraints form.
You cannot declare table-level CHECK constraints on any column defined with XML, BLOB, CLOB, Period, or JSON data types.
You cannot specify constraints other than NULL or NOT NULL for global temporary trace tables (see CREATE GLOBAL TEMPORARY TRACE TABLE ).