Constraints
Two types of constraints are provided: column constraints and table constraints. Column constraints are associated with a single column but table constraints are associated with more than one column. Any column constraint can also be formulated as a table constraint.
The specification of a (simple) constraint has the following form:
[constraint
A constraint can be named. The most important constraints are not null, unique, primary key constraints.The primary key constraint enables a unique identification of each tuple in a table.
With a primary key, the database system ensures that no duplicates appear in a table.
For example, for our EMP table, the specification
create table EMP
(
emp_code number(4) constraint pk emp primary key,
. . .
);
In this case emp_code must be unique in this table.a table must have onlyone primary key, but more than one unique keys. Null values are not allowed for primary keys.
No comments:
Post a Comment