GATE / CS ARCHIVE

GATE CSE 2015 SET 2 / QUESTION 40

GATE CSE 2015 Set 2 Q40

Database Management Systems · Relational Algebra & Calculus · Full GATE CSE 2015 Set 2 paper

GATE 2015 Set 2, Q40 2 marks · MCQ
Report issue

Relational Algebra & Calculus

Question 40, GATE 2015: R1(A, B)={(1, 5), (3, 7)}, R2(A, C)={(1, 7), (4, 9)}. Full natural outer join candidates a(1, 5, NULL), b(1, NULL, 7), c(3, NULL, 9), d(4, 7, NULL), e(1, 5, 7), f(3, 7, NULL), g(4, NULL, 9). A a, b, e, f, g not c, d; B all seven; C e, f, g not a, b; D e but not f, g.
Tap to enlarge
Your answer
Answer & solution

Official answer: C

Matching A=1 yields(1, 5, 7). Unmatched left row gives(3, 7, NULL); unmatched right row gives(4, NULL, 9). Only e, f, g occur, C. Matched rows do not additionally produce null-padded variants.

Join on the common attribute A. The A=1 rows match and produce one combined row(1, 5, 7), without extra null-padded versions. The A=3 left row has no right match, so retain it as(3, 7, NULL). The A=4 right row has no left match, so retain it as(4, NULL, 9). Values from different unmatched keys cannot be combined into(3, NULL, 9)or(4, 7, NULL). Thus e, f, g are the complete result.

Original paper, page 40 · Answer key