Skip to content
Official PYQ · 2021

GATE CS 2021 Set 1 Q27 — Relational Model: Relational Algebra

Explain with AI

The following relation records the age of 500500 employees of a company, where empNoempNo (indicating the employee number) is the key:

empAge(empNo‾,age)empAge(\underline{empNo},age)

Consider the following relational algebra expression:

ΠempNo(empAge⋈(age>age1)ρempNo1,age1(empAge))\Pi_{empNo}(empAge \Join_{(age>age1)} \rho_{empNo1,age1}(empAge))

What does the above expression generate?

Choose one option
View worked solution

Answer: C

To understand what the relational algebra expression generates, let us break it down step-by-step:

  1. Renaming Operator:

    ρempNo1,age1(empAge)\rho_{empNo1, age1}(empAge) creates a copy of the empAgeempAge relation where the attributes are renamed to empNo1empNo1 and age1age1.

  2. Theta-Join:

    The expression performs a theta-join between the original relation and the renamed relation:

    empAge⋈(age>age1)ρempNo1,age1(empAge)\text{empAge} \Join_{(age > age1)} \rho_{empNo1, age1}(\text{empAge})

    This join pairs an employee from the first relation with an employee from the second relation if and only if the first employee's age (ageage) is strictly greater than the second employee's age (age1age1).

  3. Projection:

    ΠempNo(… )\Pi_{empNo}(\dots) projects the employee numbers (empNoempNo) from the join result.

Analysis:

  • An employee's tuple will appear in the join result if there exists at least one other employee in the company who is strictly younger than them (i.e., age>age1age > age1).
  • The only employees who will not satisfy this condition are those who have the absolute minimum age in the company, as there is no employee younger than them.
  • Therefore, the projection yields the employee numbers of all employees whose age is not the minimum.

Thus, the correct option is C.

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

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