3.6k views

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$

1. Insert into $R$

2. Insert into $S$

3. Delete from $R$

4. Delete from $S$

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

1. Both I and IV

2. Both II and III

3. All of these

4. None of these

edited | 3.6k views
0
ans:-B

 a Let(PK) b c 1 2
 d(FK referring to PK of R) e f 2 1

Insert into R cannot cause any violation.

Insert into S can cause violation if any value is inserted into d of S, which value is not in a of R.

Delete from S would cause no violation.

Delete from R  would cause violation if  it any tuple is deleted,and as a result a value in a gets deleted which is refereed to by d in S.

edited
0
This question build my referential integrity constraint concept very well
2-Insert into S   and  3-Delete from R  ,can cause Violation of the Referential integrity constraints.

Hence ,ans  is  (B) Both II and III

Delete from S– Can cause violation if we delete any value of x in S, then the value referred by in R should also be deleted.

Insert into R- When we will insert any value in R it will not in S so cause the violation.

1
2