Databases Reference
In-Depth Information
175 Hutton, Alyssa Sales
174 Abel, Ellen Sales
...
152 Hall, Peter Sales
151 Bernstein, David Sales
150 Tucker, Peter Sales
178 Grant, Kimberely
30 rows selected.
Not surprisingly, she gets the same results as she did when the query used the
pre-Oracle9 i syntax. However, this form of the query is much cleaner because
the join syntax is separate from the filter criterion (employees who are sales rep-
resentatives). The query is also much easier to read.
Right Outer Join
Any left outer join can be turned into a right outer join by changing the order of the
tables and changing LEFT OUTER JOIN to RIGHT OUTER JOIN. The query in the pre-
vious section can be rewritten as RIGHT OUTER JOIN as follows:
select e.employee_id "Emp ID", e.last_name || ', ' ||
e.first_name "Name", d.department_name "Dept"
from departments d
right outer join
employees e
on e.department_id = d.department_id
where e.job_id = 'SA_REP';
Emp ID Name Dept
------- ------------------------- ----------------------
179 Johnson, Charles Sales
177 Livingston, Jack Sales
176 Taylor, Jonathon Sales
175 Hutton, Alyssa Sales
174 Abel, Ellen Sales
...
152 Hall, Peter Sales
151 Bernstein, David Sales
150 Tucker, Peter Sales
178 Grant, Kimberely
30 rows selected.
Search WWH ::




Custom Search