Unit 18, Task 1 – M1
Referential integrity is a property of data which requires
every value of one attribute of a table to exist as a value of another
attribute in a different relation. These
occur in a relational database and for a referential integrity to hold in a
relational database records can’t be deleted that contain a value referred to
by a foreign key in another table as that would break the referential
integrity.
In a database there are columns that contain values and
these uniquely identify each row within the database and this is called a
primary key. Primary key constraints
guarantee unique data within the database. This is how a database is sorted,
the primary key will identify each row and then sort them depending on the
data. A table can only contain one primary key constraint. There are also
foreign keys within a database. A foreign key is a column or a combination of
columns that is used to establish and enforce a link between the data and the
two tables to control the data that can be stored in the foreign key table.
With the foreign key the link is formed between two tables when the columns
hold the primary key value.