• edited by
14,928 views
47 47 votes

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

4 Answers

Best answer
67 67 votes

$$\overset{R}{\begin{array}{|c|c|c|} \hline \textbf {a (PK)} &  \textbf {b} & \textbf {c} \\\hline  \text{1} \\\hline \text{2}  \\\hline \end{array}} \qquad \overset{S}{\begin{array}{|c|c|c|} \hline \textbf {d (FK referring to PK of R)} &  \textbf {e} & \textbf{f} \\\hline  \text{2} \\\hline \text{1}  \\\hline \end{array}}$$

  • 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$ cannot cause any violation.
  • Delete from $R$ can cause violation if any tuple is deleted, and as a result a value in 'a' gets deleted which is referenced to by 'd' in $S.$

Correct Answer: $B$

• edited by
8 8 votes
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
Answer:
Position:
Show:

Related questions

62 62 votes
5 answers 5 answers
26.9k
26.9k views
Kathleen asked Sep 23, 2014
26,854 views
Consider the join of a relation $R$ with a relation $S$. If $R$ has $m$ tuples and $S$ has $n$ tuples then the maximum and minimum sizes of the join respectively are$m+n$...
109 109 votes
6 answers 6 answers
43.8k
43.8k views
Kathleen asked Sep 22, 2014
43,763 views
The relation book (title, price) contains the titles and prices of different books. Assuming that no two books have the same price, what does the following SQL query list...
62 62 votes
4 answers 4 answers
22.8k
22.8k views
Kathleen asked Sep 14, 2014
22,827 views
Given the relationsemployee (name, salary, dept-no), anddepartment (dept-no, dept-name,address),Which of the following queries cannot be expressed using the basic relatio...
43 43 votes
5 answers 5 answers
20.7k
20.7k views
Kathleen asked Sep 11, 2014
20,706 views
A clustering index is defined on the fields which are of typenon-key and orderingnon-key and non-orderingkey and orderingkey and non-ordering