Databases Reference
In-Depth Information
and e.job_id = j.job_id
order by employee_id;
Emp ID Name Dept Job
------ ---------- ---------- -----------------------------
100 King Executive President
101 Kochhar Executive Administration Vice President
102 De Haan Executive Administration Vice President
103 Hunold IT Programmer
104 Ernst IT Programmer
105 Austin IT Programmer
106 Pataballa IT Programmer
...
205 Higgins Accounting Accounting Manager
206 Gietz Accounting Public Accountant
106 rows selected.
To join together
join conditions to avoid undesired Car-
tesian products, resulting from combining every row of one table with every row of
one or more other tables. Cartesian products are discussed later in this chapter.
n
tables, you need at least
n-1
King is still not satisfied with the report because it's too long. He wants to see
only information about the Finance and Purchasing department people on a reg-
ular basis. Janice updates the query one more time to add another
WHERE
condi-
tion to the query:
select e.employee_id "Emp ID",
e.last_name "Name", d.department_name "Dept",
j.job_title "Job"
from employees e, departments d, jobs j
where e.department_id = d.department_id
and e.job_id = j.job_id
and e.department_id in (30, 100)
order by e.employee_id;
Emp ID Name Dept Job
------- ------------ ------------ --------------------
108 Greenberg Finance Finance Manager
109 Faviet Finance Accountant
110 Chen Finance Accountant
Search WWH ::




Custom Search