GATE | GATE-CS-2014-(Set-3) | Question 65
Consider the relational schema given below, where eId of the relation dependent is a foreign key referring to empId of the relation employee. Assume that every employee has at least one associated dependent in the dependent relation.
employee (empId, empName, empAge) dependent(depId, eId, depName, depAge)
Consider the following relational algebra query:
The above query evaluates to the set of empIds of employees whose age is greater than that of
(A) some dependent.
(B) all dependents.
(C) some of his/her dependents
(D) all of his/her dependents.
Answer: (D)
Explanation: The below subquery after the subtraction sign produces id’s of those employees who have at least one dependent with age greater than or equal the employee’s age.
When the result of above subquery is subtracted from all employees, we get the employees whose age is greater than all dependents.
Quiz of this Question
Please Login to comment...