2009. 7. 20. 14:46
Web/DB
*필드의 갯수와 자료형이 같아야한다
※ UNION - 합집합 (공통부분 제외)
select emp.employee_id, emp.first_name, emp.last_name from employees emp, departments dep, locations loc
where emp.department_id = dep.department_id and dep.location_id = loc.location_id and loc.country_id = 'DE'
union
select employee_id, last_name, last_name from employees
where job_id = 'AD_VP' ORDER by employee_id desc;
< 결과 >
204 Hermann Baer
102 De Haan De Haan
101 Kochhar Kochhar
※ UNION ALL - 합집합 (공통부분 모두)
※ INTERSECT - 교집합
※ MINUS - 차집합