This shows you the differences between two versions of the page.
Next revision | Previous revision Next revision Both sides next revision | ||
kurs:joins [2008/10/23 12:25] 127.0.0.1 external edit |
kurs:joins [2014/09/10 21:22] 127.0.0.1 external edit |
||
---|---|---|---|
Line 24: | Line 24: | ||
on employees.department_id = departments.department_id | on employees.department_id = departments.department_id | ||
order by department_name desc, last_name, first_name; | order by department_name desc, last_name, first_name; | ||
+ | |||
+ | SELECT EMPLOYEES.FIRST_NAME, | ||
+ | EMPLOYEES.LAST_NAME, | ||
+ | DEPARTMENTS.DEPARTMENT_NAME, | ||
+ | LOCATIONS.CITY | ||
+ | FROM HR.EMPLOYEES left outer join HR.DEPARTMENTS on | ||
+ | DEPARTMENTS.DEPARTMENT_ID = EMPLOYEES.DEPARTMENT_ID | ||
+ | left outer join HR.LOCATIONS on | ||
+ | LOCATIONS.LOCATION_ID = DEPARTMENTS.LOCATION_ID | ||
+ | order by department_name desc | ||
SELF JOIN | SELF JOIN | ||
Line 31: | Line 41: | ||
e.employee_id(+) = m.manager_id | e.employee_id(+) = m.manager_id | ||
order by m.employee_id | order by m.employee_id | ||
+ | |||
+ | SELECT EMPLOYEES.FIRST_NAME, | ||
+ | EMPLOYEES.LAST_NAME, | ||
+ | MANAGER.FIRST_NAME "MANAGER FIRST_NAME", | ||
+ | MANAGER.LAST_NAME "MANAGER LAST_NAME" | ||
+ | FROM HR.EMPLOYEES right join EMPLOYEES MANAGER | ||
+ | on ( (EMPLOYEES.MANAGER_ID = MANAGER.EMPLOYEE_ID) ) | ||
+ | where employees.employee_id is null | ||
+ | (89 rows) | ||
+ | |||
</code> | </code> |