My schema is as follows:
EMPLOYEE (fmane, minit, lname, ssn, birthdate, address, sex, salary, superssn, dno), KEY: ssn
DEPARTMENT (dname, dnumber, mgrssn, mgrstartdate), KEY: dnumber.
PROJECT (pname, pnumber, plocation, dnum), KEY: pnumber.
WORKS_ON (essn, pno, hours), KEY: (essn, pno)
DEPENDENT (essn, dependent-name, sex, bdate, relationship), KEY: (essn, dependent-name)
I want to find the last name and SSN of those managers who DO NOT work on any one of the projects located in Chicago.
Note: I modifited the original question to practice on SQL, so I changed managers to employees
here is what I have so far:
select e.lname
from Employee e
where e.ssn not in
(select w.essn
from works_on w, Project p
where w.pno = p.pnumber
and p.plocation = 'Cleveland')
So basically are my modification correct? also
Do I need write e.lname or just lname since people told me if there's only one item I can just simply use lname?
The most confusing part when I use NOT IN clause, how do I know when should I use e.ssn or ssn?
Thank you