The following relation records the age of 500 employees of a company, where (indicating the employee number) is the key:
Consider the following relational algebra expression:
What does the above expression generate?
GATE CSE 2021Databases › Relational Algebra & CalculusVerified
(C) Employee numbers of all employees whose age is not the minimum
The expression is a self-join of empAge with a renamed copy of itself. The join condition age > age1 keeps only pairs where the left employee is older than the right employee. Projecting empNo from the left copy therefore returns every employee who is older than at least one other employee. This is exactly the set of employees whose age is not the minimum; employees at the minimum age cannot satisfy age > age1.
The self-join keeps left-side employees whose age is strictly greater than at least one other employee's age. This is equivalent to excluding only employees who have the minimum age. Therefore the projected empNo list is 'Employee numbers of all employees whose age is not the minimum', i.e. option C.
Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.