Employee(fname, minit, lname, SSN, bdate, address, sex, salary, superssn, dno); fname,minit,lname is the employee's name; bdate is birth date; superssn is supervisor's social security #; dno is dept #
Department(dname, DNUMBER, mgrssn, mgrstartdate); mgrssn is manager ssn
Dept_locations(DNUMBER, DLOCATION); dlocation is department location
Project(Pname, PNUMBER, plocation, dnum)
Works_on(ESSN, PNO, hours); ESSN is employee ssn, pno is project number
Dependent(ESSN, DEPENDENT_NAME, sex, bdate, relationship)
I want to list last and first name, SSN of all managers who is NOT working on project 7 and located in Detroit
This look kind right:
Select e.ssn, e.lname, e.fname
from employee e, department d
where (d.mgrssn = e.ssn)
where e.ssn NOT in (
select w.essn
from works_on w
where w.pno = '07'
and p.plocation = 'Detroit'
)
I think I need to put a pno = works_on joint statement before pno = 07, but someones told me I don't need it. So i'm really confused now.
Also do I need to include where (d.mgrssn = e.ssn) in a bracket or not?