1.並集的運算
select name from test1
union [all]
select name from test2;
使用union時,默認將對結果進行排序,union all則不進行排序操作,所以會消耗更少的資源;然而,union all將不進行去重的操作~
2.交集的運算
select name from test1
intersect
select name from test2;
Oracle不支持Intersect all關鍵字!
3.差的運算
select name from test1
minus
select name from test2;
Oracle中差的運算不同於SQL標準,在SQL標準中,我們使用以下函數進行差運算
select name from test1
except [all]
select name from test2;