: 이름과 타입이 같은 모든 컬럼을 기준으로 조인을 수행
: 문제점 (무조건 같은 이름을 기준으로 조인)
- 속도가 느리다
- 원치 않는 조인이 이루어질 가능성이 있다.
: 문제해결 -> join using, join on을 사용
select department_id, department_name, location_id, city
from departments
natural join locations;
<Oracle Syntax>
select department_id, department_name, departments.location_id, city
from departments, locations
where departments.location_id = locations.location_id;
select department_id, department_name, location_id, city
from departments
natural join locations
where department_id in (20, 50);
↓ ↓ ↓
select department_id, department_name, departments.location_id, city
from departments, locations
where departments.location_id = locations.location_id --> join predicate
and department_id in (20, 50); --> non-join predicate
'Oracle > SQL Fundamentals I' 카테고리의 다른 글
8일차 # 5-11: Qualifying Ambiguous Column Names (0) | 2012.04.13 |
---|---|
8일차 # 5-8: Join Using (column name) (0) | 2012.04.13 |
8일차 Join (0) | 2012.04.13 |
8일차 # 3장, 4장 정리 문제 (0) | 2012.04.13 |
8일차 # 4-23: Nesting Group Functions (0) | 2012.04.13 |