Given relations R(w,x) and S(y,z), the result of SELECT DISTINCT w, x FROM R,…

20182003

Given relations R(w,x) and S(y,z), the result of

SELECT DISTINCT w, x
FROM R, S

Is guaranteed to be same as R, if

  1. A.

    R has no duplicates and S is non-empty

  2. B.

    R and S have no duplicates

  3. C.

    S has no duplicates and R is non-empty

  4. D.

    R and S have the same number of tuples

Attempted by 1023 students.

Show answer & explanation

Correct answer: A

  • FROM R, S creates a Cartesian product of R and S.

  • For each tuple of R, it gets repeated once for every tuple in S.

  • SELECT DISTINCT w, x removes duplicates from the final result.

Now, the result will be exactly same as R only if:

  1. R has no duplicates
    → Otherwise DISTINCT may remove tuples.

  2. S is non-empty
    → If S is empty, Cartesian product is empty → result ≠ R.

The number of tuples in S doesn’t matter as long as S is non-empty, because DISTINCT collapses repetitions back to R.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Isro