--union并操作
select e.employee_id,e.last_name from hr.employees e
where e.last_name like 'C%'
union
select e.employee_id,e.last_name from hr.employees e
where e.last_name like 'S%';
--等价于
select e.employee_id,e.last_name from hr.employees e
where e.last_name like 'C%'or e.last_name like 'S%';
-- intersect交集操作
select e.employee_id,e.last_name from hr.employees e
where e.last_name like 'C%'or e.last_name like 'S%'
intersect
select e.employee_id,e.last_name from hr.employees e
where e.last_name like 'S%'or e.last_name like 'T%';
--等价于
select e.employee_id,e.last_name from hr.employees e
where e.last_name like 'S%';
--minus差操作
select e.employee_id,e.last_name from hr.employees e
where e.last_name like 'C%'or e.last_name like 'S%'
minus
select e.employee_id,e.last_name from hr.employees e
where e.last_name like 'S%'or e.last_name like 'T%';
--等价于
select e.employee_id,e.last_name from hr.employees e
where e.last_name like 'C%';
博客:
淘宝-代做毕设: