在oracle中提供了三種型別集合操作:並(union)、交(intersect)、差(minus)
先建立乙個表:
create table emp20 as select * from emp where deptno=20 ;
1.驗證union
是返回兩個集合的所有的內容,但不包含重複的內容:
select * from emp
union
select * from emp20 ;
2.驗證union all
可以返回連個查詢中的重複內容:
select * from emp
union all
select * from emp20 ;
3.驗證intersect
4.驗證minus
select * from emp
minus
select * from emp20 ;
Oracle集合操作
1.union 得到兩個結果集的並集 不含重複值 example select name,nameid from table where classid 10 union select name,nameid form table where classid 20 相當於 select name,n...
Oracle集合操作
在oracle中提供了三種型別的集合操作 並 union 交 intersect 差 minus 首先,建立還有乙個表 emp10 建立反覆資料表 emp10 create table emp10 as select from emp where deptno 10 檢視emp10 和 emp 表資...
Oracle集合操作
size large b union all b 返回各個查詢檢索出的所有的行,不過濾掉重覆記錄 b union b 返回各個查詢檢索出的過濾掉重覆記錄的所有行,即並集 b intersect b 返回兩個查詢檢索出的共有行,即交集 b minus b 返回將第二個查詢檢索出的行從第乙個查詢檢索出的...