IAE Academy

GATE 2026 DA Q.42: solution and answer

GATE 2026 · DAQ.42 · 2 marks · MCQ

Consider the given relations , and . The relation has three columns , and . The relation has three columns , and . The relation has two columns and .

Relation : (P1, Q1, R1), (P2, Q2, R2), (P3, Q3, R2).

Relation : (P1, Q1, 2), (P1, Q2, 5), (P2, Q1, 6), (P3, Q3, 1).

Relation : (P1, T1), (P3, T2), (P4, T3), (P4, NULL).

Consider the relational algebra expression

where denotes natural join operation.

Which of the following options is the correct output for the given expression?

GATE 2026 DA question 42: Three small tables side by side.Tap to open full size
Figure from the GATE 2026 DA paper. It is part of the question.
Figure description

Three small tables side by side. X(P,Q,R): rows (P1,Q1,R1), (P2,Q2,R2), (P3,Q3,R2). Y(P,Q,S): rows (P1,Q1,2), (P1,Q2,5), (P2,Q1,6), (P3,Q3,1). Z(P,T): rows (P1,T1), (P3,T2), (P4,T3), (P4,NULL).

  1. (A)

    Two rows (P1, R1, 2) and (P1, R1, 5)

  2. (B)

    Three rows (P1, R1, 2), (P1, R1, 5) and (P2, R2, 6)

  3. (C)

    One row (P1, R1, 2)

  4. (D)

    Zero rows

Answer and solution

ANSWER

The expression returns zero rows, which is option (D).

Official answer: DSource: Official answer key, GATE 2026 DA (IIT Guwahati)

  1. Left part: is a natural join on the common attributes . The pairs in are , , . The pairs in are , , , . Only and occur in both, so the join has the rows and over .

  2. Apply . The row has and , so both conditions fail and it is removed. The row satisfies both and stays. Left result: .

  3. Right part: is a natural join on . contains . rows with give and . The row with gives . The row with has no partner in and is dropped. appears in no row.

  4. Apply . The row with is removed, leaving over .

  5. Final natural join is on the common attributes . Every tuple of has , and every tuple of has , so no pair of tuples agrees on . The join is empty.

  6. The projection of an empty relation is empty, so the output has zero rows. This is option (D).

KEY IDEA

A natural join keeps only tuples that agree on every common attribute. Evaluate each side of the final join separately and compare them on the shared attributes .

WATCH OUT FOR

Reading the final join as being on alone, or forgetting that the selection with removes the row from the left side. Another slip is to treat as the only source of rows and read off and , ignoring that the left side contains only .

From the GATE 2026 DA paper. Every question of this paper · Download the full paper · All 5 Relational algebra questions, with notes

More Relational algebra questions