The GATE Grind

GATE 2015 CS (CS2) – Question 40

Databases · Relational Model: Relational Algebra, Tuple Calculus, SQL · 2 marks · Multiple choice

R1(A,B)={(1,5),(3,7)} and R2(A,C)={(1,7),(4,9)}. Let R be their full natural outer join. Candidate tuples are 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). Which holds?

  1. R contains a,b,e,f,g but not c,d
  2. R contains all a,b,c,d,e,f,g
  3. R contains e,f,g but not a,b
  4. R contains e but not f,g

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (C) R contains e,f,g but not a,b

Explanation

The A=1 rows match and produce e=(1,5,7), without separate NULL-extended copies a or b. The unmatched A=3 row contributes f=(3,7,NULL), and unmatched A=4 contributes g=(4,NULL,9). Hence R={e,f,g}, C.

More Relational Model: Relational Algebra, Tuple Calculus, SQL questions

All Relational Model: Relational Algebra, Tuple Calculus, SQL questions →