Given two relations R1(A, B) and R2(C, D), the result of following query
Select distinct A, B from R1, R2
is guaranteed to be same as R1 provided one of the following condition is satisfied.
(A) R1 has no duplicates and R2 is empty.
(B) R1 has no duplicates and R2 is non – empty.
(C) Both R1 and R2 have no duplicates.
(D) R2 has no duplicates and R1 is non – empty.
Explanation: Select A,B
From R1, R2 :
In this query first we will take cartesian product of R1, R2 (R2 must be non empty)for this 0- R2 then select distinct A,B from cartesian product of R1, R2 (for A,B being distinct there should not any duplicate A,B).
For this query A,B → No duplicate A,B.
By combining condition for both query we will get the right condition.
So, option (B) is correct.
Quiz of this Question