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 all employees who worked more than 3 projects, but I want use outer join for this query only.
Select e.lname, e.ssn
from employee e
join e.ssn in (
select w.essn
from works_on w, project p
outer join w.pno = p.pnumber
group by w.essn
having count (*) >= 3
)
1) My outer join seems kind off or did I do need another join after the second join?
2)the one thing that confuse me is if just want the lname and not essn, do I change the e.ssn in and select w.essn inside the nested query to ssn and essn?