Previous |
Next |
Not Null, which prevents a value from being null
In the EMPLOYEES
table, the column LAST_NAME
has the NOT
NULL
constraint, which enforces the business rule that every employee must have a last name.
Unique, which prevents multiple rows from having the same value in the same column or combination of columns, but allows some values to be null
In the EMPLOYEES
table, the column EMAIL
has the UNIQUE
constraint, which enforces the business rule that an employee can have no email address, but cannot have the same email address as another employee.
Primary Key, which is a combination of NOT
NULL
and UNIQUE
In the EMPLOYEES
table, the column EMPLOYEE_ID
has the PRIMARY
KEY
constraint, which enforces the business rule that every employee must have a unique employee identification number.
Foreign Key, which requires values in one table to match values in another table
In the EMPLOYEES
table, the column JOB_ID
has a FOREIGN
KEY
constraint that references the JOBS
table, which enforces the business rule that an employee cannot have a JOB_ID
that is not in the JOBS
table.
Check, which requires that a value satisfy a specified condition
The EMPLOYEES
table does not have CHECK
constraints. However, suppose that EMPLOYEES
needs a new column, EMPLOYEE_AGE
, and that every employee must be at least 18. The constraint CHECK
(EMPLOYEE_AGE
>=
18)
enforces the business rule.
Tip: Use check constraints only when other constraint types cannot provide the necessary checking. |
REF, which further describes the relationship between the column and the object that it references
For information about REF constraints, see Oracle Database Concepts.