Let relation R2 has a ‘foreign key’ that refers to primary key of relation R1.…
2022
Let relation R2 has a ‘foreign key’ that refers to primary key of relation R1. Which of the following operation may cause violation of referential integrity constraints?
- A.
Insertion of new tuple into R2
- B.
Deletion of tuple from R1
- C.
Both option (A) and option (B)
- D.
Neither option (A) nor option (B)
Attempted by 1957 students.
Show answer & explanation
Correct answer: C
Referential integrity ensures that a foreign key in one relation must match a primary key in another relation.
Insertion into R2: When inserting a new tuple into R2, the foreign key value must exist in R1's primary key. If it does not, the insertion violates referential integrity.
Deletion from R1: When deleting a tuple from R1, if that tuple is referenced by a foreign key in R2, the reference becomes invalid. This creates a dangling reference, violating referential integrity.
Therefore, both operations can cause referential integrity violations.