集合的操作

--集合的操作

--并集 union 重复的只显示一次
--首先创建一个部门为20的表
CREATE TABLE emp20 AS SELECT * FROM emp WHERE deptno=20 ;

SELECT * FROM emp union SELECT * FROM emp20 ;
--并集 union all 重复的也显示
select * from emp20 union all select * from emp;

----交集 intersect 只显示重复的
select * from emp20 intersect select * from emp;

----差集 minus 显示对方没有的
select * from emp minus select * from emp20;

 

 



 

 



 









posted on 2017-07-26 19:26  -薛凯-  阅读(80)  评论(0编辑  收藏  举报

导航