|
|
|
SELECT fname, lname FROM employee WHERE ssn ∈ { ssn of employee who works in dept 5 } AND ssn ∈ { ssn of employee who has a dependent } |
|
|
|
Solution using set difference:
SELECT ssn FROM employee E /* We test 1 employee at a time, call him "E" */ WHERE E ∈ ( { employees of department 5 } - { employee WITH dependent } ) |
We re-write the set-difference: SELECT ssn FROM employee E /* We test 1 employee at a time, call him "E" */ WHERE E ∈ { employee of department 5 } AND E ∉ { employee WITH dependent } |