You are on page 1of 1

Q.] Explain different constraints types.

Answer:
1. NOT NULL constraint - Ensures that a column cannot have a NULL
value. The not null constraints are used to enforce domain integrity, as
the check constraints.
2. PRIMARY KEY constraint - A combination of a NOT NULL and
UNIQUE. Uniquely identifies each row in a table. Every table should
have a primary key constraint to uniquely identify each row and only
one primary key constraint can be created for each table. The primary
key constraints are used to enforce entity integrity.
3. FOREIGN KEY constraint - Uniquely identifies a row/record in
another table. Foreign keys prevent actions that would leave rows with
foreign key values when there are no primary keys with that value.
The foreign key constraints are used to enforce referential integrity.
4. CHECK constraint - Ensures that all values in a column satisfies a
specific condition. Specifying check constraints is done through a
restricted form of a search condition.
5. DEFAULT constraint - Sets a default value for a column when no
value is specified.

You might also like