GATE / CS ARCHIVE

GATE CSE 2012 / QUESTION 50

Set union followed by disjunctive theta join

Database Management Systems · Relational Algebra & Calculus · Full GATE CSE 2012 paper

GATE 2012, Q50 2 marks · MCQ
Report issue

Relational Algebra & Calculus

Question 50, GATE 2012: Relations: A(Id,Name,Age)={(12,Arun,60),(15,Shreya,24),(99,Rohit,11)}; B(Id,Name,Age)={(15,Shreya,24),(25,Hari,40),(98,Rohit,20),(99,Rohit,11)}; C(Id,Phone,Area)={(10,2200,02),(99,2100,01)}.
How many tuples result from (A∪B) ⋈_{A.Id>40 OR C.Id<15} C? The union has the schema of A.
(A) 7 (B) 4 (C) 5 (D) 9.
Question 50, GATE 2012: Relations: A(Id,Name,Age)={(12,Arun,60),(15,Shreya,24),(99,Rohit,11)}; B(Id,Name,Age)={(15,Shreya,24),(25,Hari,40),(98,Rohit,20),(99,Rohit,11)}; C(Id,Phone,Area)={(10,2200,02),(99,2100,01)}.
How many tuples result from (A∪B) ⋈_{A.Id>40 OR C.Id<15} C? The union has the schema of A.
(A) 7 (B) 4 (C) 5 (D) 9.
Tap to enlarge
Your answer
Answer & solution

Official answer: A

Relational union eliminates the two shared tuples (15, Shreya, 24) and (99, Rohit, 11), leaving five distinct tuples with Id values 12, 15, 25, 98, 99. For C.Id=10, the condition C.Id<15 is true, so all five join. For C.Id=99, only the two union tuples with Id>40 join. There are 5+2=7 result tuples, A. This is a theta join, so each qualifying pair contributes its combined tuple.

Check: The pair count can also be checked from the union side: Ids 12,15,25 each match only C.Id=10, contributing three; Ids 98,99 each match both C rows, contributing four. The total 3+4=7 agrees with counting from the C side.

Original paper, page 14 · Answer key