Which of the following query transformations (i.e., replacing the l.h.s.…

1998

Which of the following query transformations (i.e., replacing the l.h.s. expression by the r.h.s. expression) is incorrect?
R₁ and R₂ are relations. C₁, C₂ are selection conditions and A₁, A₂ are attributes of R₁.

  1. A.

    σ C₁C₂ R₁) → σ C₂C₁ (R₁))

  2. B.

    σ C₁A₁ R₁) → π A₁C₁ (R₁))

  3. C.

    σ C₁ (R₁ ∪ R₂) → σ C₁ (R₁) ∪ σ C₁ (R₂)

  4. D.

    π A₁C₁ (R₁)) → σ C₁A₁ (R₁))

Attempted by 50 students.

Show answer & explanation

Correct answer: D

  • Selection (σ) can be pushed below projection (π) only if all attributes used in the selection condition are present in the projection.

  • In Option 4:

    π A1 (σ C1 (R1))  →  σ C1 (π A1 (R1))
    
  • Here, C1 may use attributes other than A1.

  • After projection π A1, those attributes are lost, so σ C1 cannot be applied correctly.

A video solution is available for this question — log in and enroll to watch it.

Explore the full course: Gate Guidance By Sanchit Sir