일단 해보는 코딩/Oracle SQL

[오라클/SQL] 다중/여러개 테이블 [ANSI, Orcle] JOIN 하기

eun_zoey2 2022. 6. 8. 16:31
728x90

Q. 두 'king' 사원의 salary(e), first_name(e), employee_id(e), job_title(jobs), department_name(departments)를 보이시오.

-- [Oracle Join]

select last_name, salary, employee_id, job_title, department_name
from employees e, jobs j, departments d
where e.job_id = j.job_id
AND e.department_id = d.department_id
AND last_name = 'King';

-- [ANSI JOIN]

select last_name, salary, employee_id, job_title, department_name
from employees e JOIN jobs j ON e.job_id = j.job_id
                 JOIN departments d ON e.department_id = d.department_id
where last_name = 'King';