Databases Reference
In-Depth Information
The conventional referential integrity constraint on the foreign key can
be specified using SQL when defining a relation. In this relational model (or
SQL based on it), there is no direct way of specifying the attribute referen-
tial integrity constraint. However, it can still be specified in the database
designer's data dictionary and implemented using a procedural language.
Future versions of SQL will include the specifications of the attribute refer-
ential integrity constraint on the non-foreign key attributes.
Following is the suggested syntax for specifying the ARI constraint:
CREATE TABLE <TableName>
(<Attribute List> ; This attribute list must include
the referencing attribute.
ATTRIBUTE REFERENTIAL INTEGRITY: <Referencing
Attribute>
REFERENCES <Referenced Attribute>)
The relational model shown in Exhibit 5 can be written as follows:
CREATE TABLE RENTAL_PACKAGE
(TermID #INT,
RateDECIMAL (3,1),
VehTypeName CHAR(20));
CREATE TABLE VEHICLE
(VehID# INT,
Make CHAR(20),
VehTypeName CHAR(20))
ATTRIBUTE REFERENTIAL INTEGRITY:
(VehTypeName) REFERENCES RENTAL_PACKAGE
(VehTypeName));
ENFORCING THE ARI CONSTRAINT
Enforcement of the referential integrity constraint on the foreign key can
be conducted in three ways: restriction, cascading, and nullification (i.e.,
setting to a default value). The attribute referential integrity constraint can
be enforced in a similar manner.
First, the delete or update operation on the referenced attribute can be
restricted to the case where there are no matching values in the referenc-
ing attribute. Second, the delete or update operation on the referenced
Search WWH ::




Custom Search