The GATE Grind

GATE 2021 CS – Question 37

Databases · Relational Model: Relational Algebra, Tuple Calculus, SQL · 2 marks · Multiple choice

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}(empAge \bowtie_{(age>age1)} \rho_{empNo1,age1}(empAge))$
What does the above expression generate?

  1. Employee numbers of only those employees whose age is the maximum.
  2. Employee numbers of only those employees whose age is more than the age of exactly one other employee.
  3. Employee numbers of all employees whose age is not the minimum.
  4. Employee numbers of all employees whose age is the minimum.

Practise this question in The GATE Grind →

Show answer and explanation

Correct answer: (C) Employee numbers of all employees whose age is not the minimum.

Explanation

The join keeps an employee if some other employee has a strictly smaller age. So it returns everyone whose age is not the minimum.