Skip to content
Official PYQ · 2018

GATE CS 2018 Q41 — Relational Model: Relational Algebra

Explain with AI

Consider the relations r(A,B)r(A, B) and s(B,C)s(B, C), where s.Bs.B is a primary key and r.Br.B is a foreign key referencing s.Bs.B. Consider the query

Q:r⋈(σB<5(s))Q: r \bowtie (\sigma_{B<5} (s))

Let LOJ denote the natural left outer-join operation. Assume that rr and ss contain no null values.

Which of the following is NOT equivalent to QQ?

Choose one option
View worked solution

Answer: C

The query Q=r⋈(σB<5(s))Q = r \bowtie (\sigma_{B < 5}(s)) returns only those tuples from rr and ss where the join attribute B<5B < 5. Any tuple in rr with B≥5B \ge 5 is completely excluded from the result.

Let us analyze why Option C is NOT equivalent to QQ:

  • In r LOJ (σB<5(s))r \text{ LOJ } (\sigma_{B < 5}(s)), the right relation σB<5(s)\sigma_{B < 5}(s) contains only tuples with B<5B < 5.
  • For any tuple in rr with B≥5B \ge 5, there is no matching tuple in the right relation.
  • Since it is a Left Outer Join (LOJ), these unmatched tuples from rr (where B≥5B \ge 5) are still preserved in the final output, padded with NULL\text{NULL} for attribute CC.
  • Thus, the result of Option C contains tuples with B≥5B \ge 5, whereas QQ does not.

For the other options, since r.Br.B is a foreign key referencing the primary key s.Bs.B and there are no nulls, every tuple in rr has a unique matching tuple in ss. Therefore, r LOJ s≡r⋈sr \text{ LOJ } s \equiv r \bowtie s. This makes options A, B, and D equivalent to QQ:

  • A: σB<5(r⋈s)≡r⋈σB<5(s)\sigma_{B < 5}(r \bowtie s) \equiv r \bowtie \sigma_{B < 5}(s) (Standard selection push-down).
  • B: σB<5(r LOJ s)≡σB<5(r⋈s)≡Q\sigma_{B < 5}(r \text{ LOJ } s) \equiv \sigma_{B < 5}(r \bowtie s) \equiv Q.
  • D: σB<5(r) LOJ s≡σB<5(r)⋈s≡r⋈σB<5(s)≡Q\sigma_{B < 5}(r) \text{ LOJ } s \equiv \sigma_{B < 5}(r) \bowtie s \equiv r \bowtie \sigma_{B < 5}(s) \equiv Q.

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore Relational Model: Relational Algebra questions