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

The Gateway to Computer Science Excellence

First time here? Checkout the FAQ!

x

+21 votes

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**?

- $\prod_{B}(r_{1})- \prod _{C}(r_{2})= \varnothing$
- $\prod_{C}(r_{2})- \prod _{B}(r_{1})= \varnothing$
- $\prod_{B}(r_{1}) = \prod _{C}(r_{2})$
- $\prod_{B}(r_{1}) - \prod _{C}(r_{2}) \neq \varnothing$

+29 votes

Best answer

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.

+11

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 votes

Correct me if I am wrong:

A: B might not use some values of C. But B cannot have anything that C doesn't contain. So the difference will be phi. **This is the Ans.**

B: Same as option A, C might have values that B doesn't use so the diffenerce cannot be phi here. Moreover the Q askes which one is always true, this one might not be true in some cases.

C: Same argument, B and C might not be equal always.

D: Difference is phi, proven in option A.

- All categories
- General Aptitude 1.6k
- Engineering Mathematics 7.5k
- Digital Logic 3k
- Programming & DS 4.9k
- Algorithms 4.3k
- Theory of Computation 6k
- Compiler Design 2.1k
- Databases 4.2k
- CO & Architecture 3.5k
- Computer Networks 4.2k
- Non GATE 1.4k
- Others 1.5k
- Admissions 586
- Exam Queries 572
- Tier 1 Placement Questions 23
- Job Queries 72
- Projects 18

50,132 questions

53,252 answers

184,790 comments

70,509 users