Constraints
Within any business, data must often adhere to certain restrictions or rules. For example, an employee number must be unique. The database manager provides constraints as a way to enforce such rules.
The following types of constraints are available:
- NOT NULL constraints
- Unique (or unique key) constraints
- Primary key constraints
- Foreign key (or referential integrity) constraints
- (Table) Check constraints
- Informational constraints
Constraints are only associated with tables and are either defined
as part of the table creation process (using the CREATE TABLE statement)
or are added to a table's definition after the table has been created
(using the ALTER TABLE statement). You can use the ALTER TABLE statement
to modify constraints. In most cases, existing constraints can be
dropped at any time; this action does not affect the table's structure
or the data stored in it.
Note: Unique and primary constraints are
only associated with table objects, they are often enforced through
the use of one or more unique or primary key indexes.