In: Computer Science
A referential integrity constraint is defined as part of an association between two entity types. The definition for a referential integrity constraint specifies the following information:
The principal end of the constraint. (An entity type whose entity key is referenced by the dependent end.)
The entity key of the principal end.
The dependent end of the constraint. (An entity type that has a property or properties that reference the entity key of the principal end.)
The referencing property or properties of the dependent end.
Example-
Here, if we delete record number 15 in a primary table, we need to be sure that there’s no foreign key in any related table with the value of 15. We should only be able to delete a primary key if there are no associated records. Otherwise, we would end up with an orphaned record.
So, referential integrity requires that, whenever a foreign key value is used it must reference a valid, existing primary key in the parent table.
2. Violation of the ICs:-
Cause-01: Insertion in a referencing relation:-
Cause-02: Deletion from a referenced relation:-
Cause-03: Updation in a referenced relation:-