Skip to main content

GATE CSE 2007Databases › Relational Algebra & CalculusVerified

GATE CSE 2007 PYQ: Consider the relation employee (name, sex, supervisorName) with name as the key, supervisorName gives the…

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?

{e.name∣employee(e)∧(∀x)[¬employee(x)∨x.supervisorName≠e.name∨x.sex=‘‘male"]}\left\{e.name \mid employee(e) \wedge \left(\forall x\right)\left[\neg employee\left(x \right) \vee x.supervisorName \neq e.name \vee x.sex = ``male" \right]\right\}

  1. A
    Names of employees with a male supervisor.
  2. B
    Names of employees with no immediate male subordinates.
  3. C
    Names of employees with no immediate female subordinates.
    Correct answer
  4. D
    Names of employees with a female supervisor.

Answer

(C) Names of employees with no immediate female subordinates.

Approach

Rewrite the inner condition as an implication. The universal condition says: for every x, either x is not an employee, or x's supervisor is not e, or x is male. This is equivalent to: for every employee x directly supervised by e, x must be male. Hence e has no immediate female subordinate.

The inner universal condition simplifies to: if any employee x is supervised by e, then x must be male. Therefore e has no immediate female subordinates. Option C is correct.

Reviewed by GateIQ Editorial Team: IIT & IISc Alumni.