GITTA-Logo
PDF Version of this document Search Help Glossary

Lesson Navigation IconRelational database model

Unit Navigation IconConcepts

Unit Navigation IconTransforming ER-schema

Unit Navigation IconData integrity

LO Navigation IconKey integrity

LO Navigation IconEntity integrity

LO Navigation IconReferntial integrity

LO Navigation IconIntegrity endangering

Unit Navigation IconNormalization

Unit Navigation IconSummary

Unit Navigation IconRecommended Reading

Unit Navigation IconGlossary

Unit Navigation IconBibliography

Unit Navigation IconMetadata


GITTA/CartouCHe news:


Go to previous page Go to next page

Referntial integrity

In a relationship model, in contradiction to an entity relationship model ERM, there is no way to model relationships between tuples explicitly. Therefore relationships are modeled implicitly using a primary- and foreign-key concept.

Foreign key:
An attribute in a relational scheme R1 is a foreign key if it is in relationship with a primary key from R2 and if:
  • The domain (value range) of the foreign key in R1 is the same as the domain of the primary key in R2.
  • The set of values of the foreign key in R1 is a subset of all primary key values in R2.
Foreign keys usually are marked dotted underlined.

A relationship between two schemes is established by using the domain of the primary key in one scheme as the domain of a foreign key in a second scheme (with the according attributes).

Referential integrity constraints ensure that any foreign key value is always pointing on an primary key of an existing tuple. References to non-existing primary keys are not allowed. In such a case the foreign key value must be set to NULL.

The relational scheme containing the foreign key is called the referencing scheme, the scheme with the primary key is called the referenced scheme.A foreign key can also point to its own scheme.
In the early days of computer databases, only workstations were able to check for referential integrity. Today most PC-based database systems are able to check for referential integrity.

Example Referntial integrityExample Referntial integrity

In the above table Division we have Div_No as a primary key. In the second table Employee this key is used as a foreign key to associate each member to one department. For each department number in the table Employee there exists a department in the table Division. These tables are integer. If we would insert a tuple "4, Weber, A5" into table Employee then a database system should refuse this operation because in table Division there exists no value A5 and therefore there is no integrity.

Top Go to previous page Go to next page