StreakPeaked· Practice

ExamsGATETechnical

Let R and S be two relations with the following schema R(P, Q, R1, R2, R3) S(P, Q, S1, S2) where {P,Q} is the key for both schemas. Which of the following queries are equivalent? I. πP (R⋈S) II. πP (R) ⋈ πP (S) III. πP (πP,Q (R) ⋂ πP,Q (S)) IV. πP (πP,Q (R) − (πP,Q (R) − πP,Q (S)))

  1. Only I and II
  2. Only I and III
  3. Only I, II and III
  4. Only I, III and IV

Correct answer: Only I, III and IV

Solution

Options I, III, and IV are equivalent because they all yield the same result by focusing on the common key attributes P and Q from both relations R and S. Option I directly joins R and S and projects P, while III uses intersection to find common keys, and IV effectively retrieves the same keys by eliminating non-matching entries. Option II, however, does not guarantee the same result as it joins the projections of R and S separately, which may lead to different outcomes.

Related GATE Technical questions

⚔️ Practice GATE Technical free + battle 1v1 →