-
Let R and S be relational schemas such that R = {a, b, c} and S = {c}. Now consider the following queries on the database:
1. πR - S - πR - S (πR - S(r) × S - πr - S , S (r))
2. { t | t ∈ πR - S(r) ∧ ∀ u ∈ s (∃ v ∈ r ( u = v[s] ∧ t = v[ R - S ] ) ) }
3. { t | t ∈ πR - S(r) ∧ ∀ u ∈ s (∃ u ∈ s ( u = v[s] ∧ t = v[ R - S ] ) ) }
4. Select R.a, R. b
From R, S
Where R.c = S.c
Which of the above queries are equivalent?
-
- 1 and 2
- 1 and 3
- 2 and 4
- 3 and 4
- 1 and 2
Correct Option: C
This is very clear from the options itself that the option 2 and option 4 are equivalent as option 2 is technical representation of code given in option 4. Therefore
{ t | t ∈ πR - S (r) ∈ ∃u ∈ s(∃v ∈ r(u = v[s] ∧ t = v [R - S])) }
= Select R.a, R.b
From R, S
= Where R.c = S.c