Multiple choice

Let R (a, b, c) and S (d, e, f) be the two relations in which d is the foreign key of S that refers to the primary key of R. Consider the following four operations regarding R and S; A. Insert into R B. Insert into S C. Delete from R D. Delete from S Which of the following is true about the above referential integrity constraint?

  1. None of these can cause its violation.

  2. All of these can cause its violation.

  3. Both (1) and (4) can cause its violation.

  4. Both (2) and (3) can cause its violation.

Reveal answer Fill a bubble to check yourself
D Correct answer
Explanation

With foreign key d in S referencing primary key of R: inserting into S (option B) can violate if the d value doesn't exist in R. Deleting from R (option C) can violate if existing rows in S reference the deleted R value. Inserting into R and deleting from S don't cause violations. Therefore, both (2) and (3) can cause referential integrity violations.