Integrity Enhancement Feature
Integrity Enhancement Feature
In this section, we examine the facilities provided by the SQL standard for integrity
control. Integrity control consists of constraints that we wish to impose in order to protect
the database from becoming inconsistent. We consider five types of integrity constraint
(see Section 3.3):
n required data;
n domain constraints;
n entity integrity;
n referential integrity;
n general constraints.
These constraints can be defined in the CREATE and ALTER TABLE statements, as we
will see shortly.
Required Data
Some columns must contain a valid value; they are not allowed to contain nulls. A null
is distinct from blank or zero, and is used to represent data that is either not available,
missing, or not applicable (see Section 3.3.1). For example, every member of staff must
have an associated job position (for example, Manager, Assistant, and so on). The ISO
standard provides the NOT NULL column specifier in the CREATE and ALTER TABLE
statements to provide this type of constraint. When NOT NULL is specified, the system
rejects any attempt to insert a null in the column. If NULL is specified, the system accepts
nulls. The ISO default is NULL. For example, to specify that the column position of the
Staff table cannot be null, we define the column as:
position VARCHAR(10) NOT NULL
In this section, we examine the facilities provided by the SQL standard for integrity
control. Integrity control consists of constraints that we wish to impose in order to protect
the database from becoming inconsistent. We consider five types of integrity constraint
(see Section 3.3):
n required data;
n domain constraints;
n entity integrity;
n referential integrity;
n general constraints.
These constraints can be defined in the CREATE and ALTER TABLE statements, as we
will see shortly.
Required Data
Some columns must contain a valid value; they are not allowed to contain nulls. A null
is distinct from blank or zero, and is used to represent data that is either not available,
missing, or not applicable (see Section 3.3.1). For example, every member of staff must
have an associated job position (for example, Manager, Assistant, and so on). The ISO
standard provides the NOT NULL column specifier in the CREATE and ALTER TABLE
statements to provide this type of constraint. When NOT NULL is specified, the system
rejects any attempt to insert a null in the column. If NULL is specified, the system accepts
nulls. The ISO default is NULL. For example, to specify that the column position of the
Staff table cannot be null, we define the column as:
position VARCHAR(10) NOT NULL
Integrity Enhancement Feature
Reviewed by Shopping Sale
on
11:45
Rating:
heu
ReplyDelete