Referential integrity
Many relational databases include referential integrity sure referential integrity makes sure
relationships stay stable and consistent throughout such as when it’s getting synchronised
and updated. Referential integrity will not work when the relation to the foreign key no longer
exists. For example if a relationship exists between two tables referential integrity makes
sure the relationships stay consistent and stable, you can force referential integrity when you
create a new relationship between two tables so when you delete something related within
the relationship it will alert you when if you tried to delete that record however if you still
delete the record it will also delete everything deleted to the data , for example if student ID
is linked with the Student Record it will delete everything related to that data.
This is an example of when you can enforce referential
integrity between two fields. Most of the time when you
enforce referential integrity the relationship line will be bold
which means it worked. The image below shows this
working.
First I turned off enforce referential integrity between for a relationship which was
between the student and Incident Table.
I then deleted went onto the student table which I deleted one of the student records
which was 150001.