A
constraint is a limitation that you place on the data that users can enter into
a column or group of columns. A constraint is part of the table definition; you
can implement constraints when you create the table or later. You can remove a
constraint from the table without affecting the table or the data, and you can
temporarily disable certain constraints.
constraint is a limitation that you place on the data that users can enter into
a column or group of columns. A constraint is part of the table definition; you
can implement constraints when you create the table or later. You can remove a
constraint from the table without affecting the table or the data, and you can
temporarily disable certain constraints.
Constraints
make it possible to further restrict the domain of an attribute. A domain
describes the set of possible values for a given attribute, and can be
considered a constraint on the value of the attribute. For instance, a
constraint can restrict a given integer attribute to values between 1 and 10.
make it possible to further restrict the domain of an attribute. A domain
describes the set of possible values for a given attribute, and can be
considered a constraint on the value of the attribute. For instance, a
constraint can restrict a given integer attribute to values between 1 and 10.
Types of constraints
There are also some
standard constraints that are intrinsic in most of the DBMSs. These are;
standard constraints that are intrinsic in most of the DBMSs. These are;
|
Constraint name
|
Description
|
|
Primary key
|
Designates a column or combination of columns as
Primary Key and therefore, values of columns cannot be repeated or left blank. |
|
Foreign key
|
Relates one table with another table.
|
|
Unique
|
Specifies that values of a column or combination of
columns cannot be repeated. |
|
Not null
|
Specifies that a column cannot contain empty values.
|
|
Check
|
Specifies a condition which each row of a table must
satisfy. |