Question
The following relation records the age of 500 employees of a company, where empNo (indicating the employee number) is the key:
Consider the following relational algebra expression:
What does the above expression generate?
Official answer and solution
- Official answer
- C
- From
- Official GATE 2021 answer key
Solution
Analyze the theta-join condition on self-joined relation empAge to determine which employee records survive the join.
The expression performs a theta-join between empAge and a renamed copy with condition :
An employee tuple with age successfully pairs with at least one tuple with age in the second relation if and only if there exists some employee in the company who has a strictly smaller age ().
- If an employee has the minimum age in the company, there is no employee with age strictly smaller than theirs; thus no tuple satisfies , and their employee number will never appear in the join result.
- For every employee whose age is NOT the minimum, there exists at least one employee with a strictly lower age (namely, the employee(s) with minimum age), so this condition evaluates to true and their
empNois included.
Therefore, the expression generates the employee numbers of all employees whose age is not the minimum (option C).
C
The answer is the one in the official GATE answer key. The solution is this site's own explanation.
Source
- Paper
- GATE 2021 Computer Science and Information Technology (CS, Set-1)
- Question
- 37 of 65, printed as CS Q.27
- Section
- Computer Science and Information Technology
Report an error in this question
GATE questions are the work of the organising institutes. This site is independent and is not affiliated with them.