I have an SQL assignment due tonight and nearly done with it, but one question is bothering the hell out of me.
The question is:
Still using Oracle join syntax, alter the previous query so that it also includes the employee record of the employee with no department_id, „Grant‟.
This is the code I have:
SELECT e.last_name, d.department_name, e.salary, c.country_name
FROM dept d, emp e, countries c, locations l
WHERE d.department_id = e.department_id
AND c.country_id = l.country_id
AND d.location_id = l.location_id;
Now other than I probably could have done a better job on the statement, the problem is I can't figure out where to do an outer join. It seems like I should do an outer join on d.department_id, but when I nothing happens unless I remove the last line of code, but that leaves me with a partial Cartesian result.
Crappy pic of what the result SHOULD look like:
http://i47.tinypic.com/o9idyu.png
XI Wiki

