The following relation records the age of employees of a company, where (indicating the employee number) is the key:
Consider the following relational algebra expression:
What does the above expression generate?
View worked solution
Answer: C
To understand what the relational algebra expression generates, let us break it down step-by-step:
- Renaming Operator:
creates a copy of the relation where the attributes are renamed to and .
- Theta-Join:
The expression performs a theta-join between the original relation and the renamed relation:
This join pairs an employee from the first relation with an employee from the second relation if and only if the first employee's age () is strictly greater than the second employee's age ().
- Projection:
projects the employee numbers () from the join result.
Analysis:
- An employee's tuple will appear in the join result if there exists at least one other employee in the company who is strictly younger than them (i.e., ).
- The only employees who will not satisfy this condition are those who have the absolute minimum age in the company, as there is no employee younger than them.
- Therefore, the projection yields the employee numbers of all employees whose age is not the minimum.
Thus, the correct option is C.
Free practice · Your answers on this page are not saved.
