Question:medium

The following relation records the age of 500 employees of a company, where empNo (indicating the employee number) is the key:
\[ empAge(empNo, age) \] Consider the following relational algebra expression:
\[ \Pi_{empNo}\big( empAge \;\Join_{age > age_1}\; \rho_{empNo_1,\,age_1}(empAge) \big) \] What does the above expression generate?

Show Hint

Self-joins with conditions like \(>\) or \(<\) are commonly used to eliminate minimum or maximum values in relational algebra.
Updated On: Jan 30, 2026
  • Employee numbers of only those employees whose age is the maximum.
  • Employee numbers of only those employees whose age is more than the age of exactly one other employee.
  • Employee numbers of all employees whose age is not the minimum.
  • Employee numbers of all employees whose age is the minimum.
Show Solution

The Correct Option is C

Solution and Explanation

Step 1: Interpret the self-join.
The relation ρempNo₁, age₁(empAge) represents a renamed copy of the same table empAge.

The join condition age > age₁ compares tuples from the original table with tuples from its renamed copy, selecting pairs where one employee is older than another.


Step 2: Meaning of the join result.
If an employee’s age is not the minimum in the table, then there exists at least one other employee with a smaller age.

Such an employee will satisfy the condition age > age₁ for at least one tuple in the renamed relation and hence will appear in the join result.


Step 3: Role of projection.
The projection ΠempNo removes all attributes except the employee number.

Thus, only the employee numbers of those employees satisfying the join condition are retained.


Step 4: Employees excluded from the result.
Employees with the minimum age in the table have no other employee younger than them.

Therefore, they never satisfy age > age₁ and are excluded from the result of the expression.


Final Conclusion:
The given relational algebra expression returns the employee numbers of all employees whose age is not the minimum in the relation.

Was this answer helpful?
0