GATE / CS ARCHIVE

GATE CSE 2021 SET 1 / QUESTION 27

GATE CSE 2021 Set 1 Q27

Database Management Systems · Relational Algebra & Calculus · Full GATE CSE 2021 Set 1 paper

GATE 2021 Set 1, Q27 2 marks · MCQ
Report issue

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.
Tap to enlarge
Your answer
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.

Original paper, page 24 · Answer key