oracle中union 、union all和 or的区别
union all 是合集,用于合并多个数据集。当一个数据集的列不够时,使用null来填充该列的值,而空字符串在Oracle中相当于null。
union 取出合集然后再去掉重复的数据,单个数据集里重复的数据也会被去重
or 是取两个结果的合集
select * from emp where seqno = 5566 or name = 'tree'; --可改写为 select * from emp where seqno=5566 union select * from emp where name= 'tree'; --如果不需要去重,也可以改写为 select * from emp where seqno=5566 union all select * from emp where name= 'tree';

浙公网安备 33010602011771号