Relational Algebra & Calculus
![Question 27, GATE 2021: empAge(empNo,age) stores ages of 500 employees, with empNo a key. Evaluate π_empNo(empAge ⋈_[age>age1] ρ_[empNo1,age1](empAge)). A employee numbers with maximum age only; B those older than exactly one other employee; C all those whose age is not minimum; D all those with minimum age.](../../assets/questions/CS-2021-S1-Q37-1.webp)
Answer & solution
Official answer: C
The renamed second copy supplies another employee’s age. The theta join retains a first-copy employee whenever some other row has a strictly smaller age. Projecting empNo therefore returns exactly employees whose age is not the minimum. Minimum-age ties are all excluded. Thus C.
The join is existential after projection: an employee appears if there exists any employee of smaller age. An employee of minimum age has no such witness and is excluded, even if multiple employees tie for minimum. For ages 20,20,30,40 the output contains the 30- and 40-year-old employee numbers. The 40-year-old has several witnesses, but set projection removes duplicates; it is not restricted to 'exactly one' younger employee.