The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
+20 votes
1.9k views

Suppose $R_{1} (\underline{A}, B)$ and $R_{2} (\underline{C}, D) $ are two relation schemas. Let $r_{1}$ and $r_{2}$ be the corresponding relation instances. $B$ is a foreign key that refers to $C$ in $R_{2}$. If data in $r_{1}$ and $r_{2}$ satisfy referential integrity constraints, which of the following is ALWAYS TRUE?

  1. $\prod_{B}(r_{1})- \prod _{C}(r_{2})= \varnothing$
  2. $\prod_{C}(r_{2})- \prod _{B}(r_{1})= \varnothing$
  3. $\prod_{B}(r_{1}) = \prod _{C}(r_{2})$
  4. $\prod_{B}(r_{1}) - \prod _{C}(r_{2}) \neq \varnothing$
asked in Databases by Veteran (369k points)
edited by | 1.9k views
0
A is correct

As B only contains the value present in C as it refers C.

1 Answer

+28 votes
Best answer

Answer is A.

Referential integrity means, all the values in foreign key should be present in primary key.

$r2(c)$ is the super set of $r1(b)$

So, {subset - superset} is always empty set.

answered by Active (3.3k points)
edited by
0
but it is possible that r1 has less tuple than r2 and how subset - superset=empty?
0
Subset will likely to have less than equal to tupples to the superset, anyway the difference will nullify all. So, produces a empty table/relation.
+9
Referential integrity does not prevent NULL value in foreign key, right ? If so, then maybe, $\Pi_{B}(r_1) - \Pi_{C}(r_2) = \{NULL\}$
0
This is true in Relational Algebra since they remove duplicates automatically .. Incase if we replace both projection operators with SELECT in SQL then this neednot be TRUE as SELECT in SQL doesnot remove duplicates unlike SELECT DISTINCT...
0

@Rounak Agarwal referential integrity constraint says that the value present in foreign key is subset of value present in referred attribute since primary attribute can.t have null values so foreign key can't have null values to preseve the integrity constraint.

0
What if in R1(A,B) , B also contains null value ,then is it true that null = Ø
0
let B has value {1,5,8,15}(foreign key)

and let C has value {1,5,6,7,8,15,19}

so here B-C=Ø

notice that to satisfy Referential integrity  constrain all the foreign should be present in referenced relation.
Answer:

Related questions



Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

44,284 questions
49,776 answers
164,291 comments
65,856 users