teach-ict.com logo

THE education site for computer science and ICT

Referential Integrity

A database term.

A relational database depends on primary keys that point to related records in different tables.

So a primary key may point to record B in table 1 and to record C in table 2. The two records make up all the information related to the primary key.

For example, an employee may have an employee number as their primary key that point to their salary in the pay table and to their address in the address table.

This is where 'referential integrity' comes in. If the primary key does not point to an entry in the salary table, then the database is broken (and you have a very upset employee!).

So switching on the 'enforce referential integrity' feature in the database application makes sure that a record exists in each table that has to have a primary key pointing to it.

 

Challenge see if you can find out one extra fact on this topic that we haven't already told you

Click on this link: Referential Integrity