oracle中union和union all minus 有什么功能
发布网友
发布时间:2022-04-08 01:32
我来回答
共2个回答
懂视网
时间:2022-04-08 05:53
select e.employee_id,e.last_name from hr.employees ewhere e.last_name like ‘C%‘unionselect e.employee_id,e.last_name from hr.employees ewhere e.last_name like ‘S%‘;--等价于select e.employee_id,e.last_name from hr.employees ewhere e.last_name like ‘C%‘or e.last_name like ‘S%‘;
-- intersect交集操作select e.employee_id,e.last_name from hr.employees ewhere e.last_name like ‘C%‘or e.last_name like ‘S%‘intersectselect e.employee_id,e.last_name from hr.employees ewhere e.last_name like ‘S%‘or e.last_name like ‘T%‘;--等价于select e.employee_id,e.last_name from hr.employees ewhere e.last_name like ‘S%‘;
--minus差操作select e.employee_id,e.last_name from hr.employees ewhere e.last_name like ‘C%‘or e.last_name like ‘S%‘minusselect e.employee_id,e.last_name from hr.employees ewhere e.last_name like ‘S%‘or e.last_name like ‘T%‘;--等价于select e.employee_id,e.last_name from hr.employees ewhere e.last_name like ‘C%‘;
博客:http://www.cnblogs.com/ssslinppp http://blog.sina.com.cn/spstudy 淘宝-代做毕设:http://shop110473970.taobao.com/?spm=a230r.7195193.1997079397.42.AvYpGW http://shop125186102.taobao.com/?spm=a1z10.1-c.0.0.SsuajD来自为知笔记(Wiz)
【Oracle学习笔记-5--】集合操作之union,intersect和minus操作
标签:
热心网友
时间:2022-04-08 03:01
不一样。
union all是两个查询结果的并集。
union是两个查询结果的并集,但是去掉重复的数据。
由于union比union all多一步操作,因此效率上会有所降低。
另外,union会对查询结果做排序。