Skip to main content

GATE CSE 2015Databases › Relational Algebra & CalculusVerified

GATE CSE 2015 PYQ: Consider two relations R 1 ( A , B ) R_1(A,B) R 1 ​ ( A , B ) with the tuples ( 1 , 5 ) , ( 3 , 7 ) (1,5),…

Consider two relations R1(A,B)R_1(A,B) with the tuples (1,5),(3,7)(1,5), (3,7) and R2(A,C)=(1,7),(4,9)R_2(A,C) = (1,7),(4,9).

Assume that R(A,B,C)R(A,B,C) is the full natural outer join of R1R_1 and R2R_2. Consider the following tuples of the form (A,B,C):(A,B,C):

a=(1,5,null),b=(1,null,7),c=(3,null,9),d=(4,7,null),e=(1,5,7),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). f=(3,7,null), g=(4,null,9).

Which one of the following statements is correct?

  1. A
    RR contains a,b,e,f,ga, b, e, f, g but not c,dc, d.
  2. B
    RR contains all a,b,c,d,e,f,ga, b, c, d, e, f, g.
  3. C
    RR contains e,f,ge, f, g but not a,ba, b.
    Correct answer
  4. D
    RR contains ee but not f,gf, g.

Answer

(C) R R R contains e , f , g e, f, g e , f , g but not a , b a, b a , b .

Approach

Compute the full natural outer join of R1(A,B) and R2(A,C) on the common attribute A. Include matched tuples once, and pad unmatched tuples from either relation with NULLs in the other relation's attributes.

The full natural outer join on A preserves all tuples from both relations: matching tuples are combined, and non-matching tuples are NULL-padded. This yields exactly e, f, and g, matching option C.

Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.