select department_id, department_name, location_id, city
from departments
join locations
using (location_id);
<Oracle Syntax>
select department_id, department_name, departments.location_id, city
from departments, locations
where departments.location_id = locations.location_id;
cf.) natural join, join using 에선
조인대상이 되는 컬럼에 테이블 이름을 쓸 수 없습니다.
select department_id, department_name, departments.location_id, city
from departments
natural join locations;
select department_id, department_name, departments.location_id, city
from departments
join locations
using (location_id);
select department_id, department_name, location_id, city
from departments
join locations
using (departments.location_id);
'Oracle > SQL Fundamentals I' 카테고리의 다른 글
8일차 # 5-12: Table Alias (0) | 2012.04.13 |
---|---|
8일차 # 5-11: Qualifying Ambiguous Column Names (0) | 2012.04.13 |
8일차 # 5-6: Natural Join (0) | 2012.04.13 |
8일차 Join (0) | 2012.04.13 |
8일차 # 3장, 4장 정리 문제 (0) | 2012.04.13 |