检验minus差集作用:(输出1)
select a from
(select 1 a from dual union all
select 1 a from dual union all
select 3 a from dual union all
select 4 a from dual ) t1
minus
select a from
(select 21 a from dual union all
select 21 a from dual union all
select 3 a from dual union all
select 4 a from dual ) t2;
检验intersect交集作用:(输出3,4)
select a from
(select 1 a from dual union all
select 3 a from dual union all
select 3 a from dual union all
select 4 a from dual ) t1
intersect
select a from
(select 21 a from dual union all
select 3 a from dual union all
select 3 a from dual union all
select a from
(select 1 a from dual union all
select 1 a from dual union all
select 3 a from dual union all
select 4 a from dual ) t1
minus
select a from
(select 21 a from dual union all
select 21 a from dual union all
select 3 a from dual union all
select 4 a from dual ) t2;
检验intersect交集作用:(输出3,4)
select a from
(select 1 a from dual union all
select 3 a from dual union all
select 3 a from dual union all
select 4 a from dual ) t1
intersect
select a from
(select 21 a from dual union all
select 3 a from dual union all
select 3 a from dual union all
select 4 a from dual ) t2;
注:两者对结果集进行统计的结果,故有此也可得知,需要谨慎使用,效率肯定远低于union all