UGC-NET Jul 2016 · Relational Algebra

MCQ · 2 marks · Problem DBMS-RELM-0013

Consider the relations \(R(A, B)\) and \(S(B, C)\) and the following four relational algebra queries over \(R\) and \(S\):I. \(\pi_{A, B} (R \bowtie S)\)II. \(R \bowtie \pi_B(S)\)III. \(R \cap (\pi_A(R) \times \pi_B (S))\)IV. \(\pi_{A, R.B} (R \times S)\), where \(R.B\) refers to the column \(B\) in table \(R\)One can determine that:
  1. A
    I, III and IV are the same query
  2. B
    II, III and IV are the same query
  3. C
    I, II and IV are the same query
  4. D
    I, II and III are the same query

Solve it on GATE DA practice →More Relational Model & SQL problems

Show the worked solutionI. The tuples of \(R\) whose \(B\) value appears in \(S\).II. Joining \(R\) with the set of \(B\) values of \(S\): again the tuples of \(R\) whose \(B\) appears in \(S\).III. \((a,b)\in R\) is kept iff \(a\in\pi_A(R)\) (always) and \(b\in\pi_B(S)\): the same set.IV. A Cartesian product has no join condition, so it returns all of \(R\) whenever \(S\) is non-empty: different.So I, II and III are the same query.Answer: D

GATE DA practice: past exam problems by chapter, with worked solutions · gatedaprep.com