Consider the relation employee(name, sex, supervisorName) with name as the…
2007
Consider the relation employee(name, sex, supervisorName) with name as the key. supervisorName gives the name of the supervisor of the employee under consideration. What does the following Tuple Relational Calculus query produce? 
- A.
Names of employees with a male supervisor.
- B.
Names of employees with no immediate male subordinates.
- C.
Names of employees with no immediate female subordinates.
- D.
Names of employees with a female supervisor.
Attempted by 33 students.
Show answer & explanation
Correct answer: C
Answer: Names of employees with no immediate female subordinates.
Reasoning:
The query selects e.name for tuples e that satisfy employee(e) and the universal condition (∀x)(¬employee(x) ∨ x.supervisorName ≠ e.name ∨ x.sex = "male").
The universal condition can be rewritten using negation of an existential: it is equivalent to ¬∃x( employee(x) ∧ x.supervisorName = e.name ∧ x.sex ≠ "male" ).
Thus there does not exist any employee x who is an immediate subordinate of e and whose sex is not "male". Interpreting sex ≠ "male" as female in the given setting, the query returns employees who have no immediate female subordinates.
Common misunderstanding: The query talks about e's subordinates (x with x.supervisorName = e.name), not about e's supervisor. So any option describing the sex of e's supervisor is not correct.
A video solution is available for this question — log in and enroll to watch it.