Database Reference
In-Depth Information
Entity Integrity Rule: The entity integrity rule states that no component of the
primary key in a base relation is allowed to accept nulls. Put another way, in a relational
model, we never record information about something that we cannot identify. Three
points are worth noting here:
The rule applies to base relations.
The rule applies to primary key, not alternate keys.
The primary key must be wholly non-null.
Referential Integrity Rule: The referential integrity rule states that the database
must not contain unmatched foreign key values. By unmatched foreign key value, we
mean a non-null foreign key value for which there is no match in the referenced (target)
relation. Put another way, if B references A then A must exist. The following points should
be noted:
The rule requires that foreign keys must match primary keys, not
alternate keys.
Foreign key and referential integrity are defined in terms of
each other. It is not possible to explain one without mentioning
the other.
4.2 Foreign Key Concept
The concept of a foreign key was introduced in the previous chapter. Let us revisit this
concept, by introducing a more formal definition:
We will use the notation R1 → R2 to mean, the relation R1 references the relation R2.
In this case, R1 is the referencing (primary) relation and R2 is the referenced relation.
Since R1 is the referencing relation, it contains a foreign key. We will also use the notion
R1{A, B, C, ...} to mean, the relation R1 contains attributes A, B, C, and so on. Where
specific examples are given, the relation-name will be highlighted or placed in upper
case; attribute-names of specific examples will not be highlighted when stated with the
related relation; however, they will be highlighted when reference is made to them from
the body of the text.
 
Search WWH ::




Custom Search