菠菜平台出租与oracle集合运算

– 集合运算
–菠菜平台出租【企 娥:217 1793 408】
– union
– 主要是从两个查询中返回消除重复后的数据
– 效果类似于 distinct
select from scott.emp; – 13
select
from scott.dept; – 7

select deptno from scott.emp
union
select deptno from scott.dept;

– union all
– 主要是从两个查询中返回所有的数据
select deptno from scott.emp
union all
select deptno from scott.dept;

– intersect
– 主要是从两个查询中返回都会出现的数据
select deptno from scott.emp
intersect
select deptno from scott.dept;

– minus
– 用来判断存在第一张表,而不存在第二张表中的数据。12,14,40,50
select deptno from scott.dept
minus
select deptno from scott.emp;

猜你喜欢

转载自blog.51cto.com/13945937/2166301