Databases Reference
In-Depth Information
from employees join departments using (department_id);
Emp ID Name Dept
---------- -------------------------- --------------------
100 King, Steven Executive
101 Kochhar, Neena Executive
102 De Haan, Lex Executive
103 Hunold, Alexander IT
104 Ernst, Janice IT
105 Austin, David IT
106 Pataballa, Valli IT
...
201 Hartstein, Michael Marketing
202 Fay, Pat Marketing
203 Mavris, Susan Human Resources
204 Baer, Hermann Public Relations
205 Higgins, Shelley Accounting
206 Gietz, William Accounting
106 rows selected.
Join On
This particular form of an equijoin appears to be a good compromise between
simplicity and accuracy, but Janice knows that she'll sooner or later use another
form of an equijoin, the JOIN ... ON syntax. She rewrites the query once more
as follows:
select employee_id "Emp ID", last_name || ', ' ||
first_name "Name", department_name "Dept"
from employees e join departments d
on e.department_id = d.department_id;
Emp ID Name Dept
---------- -------------------------- --------------------
100 King, Steven Executive
101 Kochhar, Neena Executive
102 De Haan, Lex Executive
103 Hunold, Alexander IT
...
203 Mavris, Susan Human Resources
204 Baer, Hermann Public Relations
Search WWH ::




Custom Search