Let R(a, b, c) and S(d, e, f) be two relations in which d is the foreign key…

2016

Let R(a, b, c) and S(d, e, f) be two relations in which d is the foreign key of S that refers to the primary key of R. Consider the following four operations R and S.

I. Insert into R

II. Insert into S

III. Delete from R

IV. Delete from S

Which of the following can cause violation of the referential integrity constraint above?

  1. A.

    Both I and IV

  2. B.

    Both II and III

  3. C.

    All of these

  4. D.

    None of these

Attempted by 412 students.

Show answer & explanation

Correct answer: B

Referential integrity requires that any foreign key value in table S must correspond to an existing primary key in table R. Operation II (Insert into S) can violate this constraint if the inserted foreign key value does not exist in R. Operation III (Delete from R) can violate this constraint if the deleted primary key is referenced by rows in S. Consequently, only operations II and III pose a risk to referential integrity.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Isro