[Developer] Cube
cube(a,b) 統計列包含:group(a,b)+group(a)+group(b)+group()
cube(a,b,c) 統計列包含:(a,b,c)+group(a,b)+group(a,c)+group(b,c)+group(a)+group(b)+group(c)+group()
……以此類推ing……
cube分組級別更多,結果更精細
SQL> edit
Wrote file afiedt.buf
1 select b.dname,a.job,sum(sal)
2 from emp a,dept b
3 where a.deptno=b.deptno
4 group by cube(b.dname,a.job)
5* order by 1
SQL> /
DNAME JOB SUM(SAL)
------------------------ --------------- ----------
ACCOUNTING CLERK 1300
ACCOUNTING MANAGER 2450
ACCOUNTING PRESIDENT 5000
ACCOUNTING 8750
RESEARCH ANALYST 6000
RESEARCH CLERK 1900
RESEARCH MANAGER 2975
RESEARCH 10875
SALES CLERK 950
SALES MANAGER 2850
SALES SALESMAN 5600
SALES 9400
ANALYST 6000
CLERK 4150
MANAGER 8275
PRESIDENT 5000
SALESMAN 5600
29025
18 rows selected.
部分cube,提出合計和group by job.
SQL> edit
Wrote file afiedt.buf
1 select b.dname,a.job,sum(sal)
2 from emp a,dept b
3 where a.deptno=b.deptno
4 group by b.dname,cube(a.job)
5* order by 1
SQL> /
DNAME JOB SUM(SAL)
------------------------ --------------- ----------
ACCOUNTING CLERK 1300
ACCOUNTING MANAGER 2450
ACCOUNTING PRESIDENT 5000
ACCOUNTING 8750
RESEARCH ANALYST 6000
RESEARCH CLERK 1900
RESEARCH MANAGER 2975
RESEARCH 10875
SALES CLERK 950
SALES MANAGER 2850
SALES SALESMAN 5600
SALES 9400
12 rows selected.
cube(a,b,c) 統計列包含:(a,b,c)+group(a,b)+group(a,c)+group(b,c)+group(a)+group(b)+group(c)+group()
……以此類推ing……
cube分組級別更多,結果更精細
SQL> edit
Wrote file afiedt.buf
1 select b.dname,a.job,sum(sal)
2 from emp a,dept b
3 where a.deptno=b.deptno
4 group by cube(b.dname,a.job)
5* order by 1
SQL> /
DNAME JOB SUM(SAL)
------------------------ --------------- ----------
ACCOUNTING CLERK 1300
ACCOUNTING MANAGER 2450
ACCOUNTING PRESIDENT 5000
ACCOUNTING 8750
RESEARCH ANALYST 6000
RESEARCH CLERK 1900
RESEARCH MANAGER 2975
RESEARCH 10875
SALES CLERK 950
SALES MANAGER 2850
SALES SALESMAN 5600
SALES 9400
ANALYST 6000
CLERK 4150
MANAGER 8275
PRESIDENT 5000
SALESMAN 5600
29025
18 rows selected.
部分cube,提出合計和group by job.
SQL> edit
Wrote file afiedt.buf
1 select b.dname,a.job,sum(sal)
2 from emp a,dept b
3 where a.deptno=b.deptno
4 group by b.dname,cube(a.job)
5* order by 1
SQL> /
DNAME JOB SUM(SAL)
------------------------ --------------- ----------
ACCOUNTING CLERK 1300
ACCOUNTING MANAGER 2450
ACCOUNTING PRESIDENT 5000
ACCOUNTING 8750
RESEARCH ANALYST 6000
RESEARCH CLERK 1900
RESEARCH MANAGER 2975
RESEARCH 10875
SALES CLERK 950
SALES MANAGER 2850
SALES SALESMAN 5600
SALES 9400
12 rows selected.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24237320/viewspace-2079837/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【CUBE】Oracle分組函式之CUBE魅力Oracle函式
- Cube 技術解讀 | Cube 小程式技術詳解
- Cube 技術解讀 | Cube 渲染設計的前世今生
- Cube 技術解讀 | Cube 卡片技術棧詳解
- Cube 緯度分析
- Oracle OCP(12):ROLLUP & CUBEOracle
- 【kylin】Failed to build cubeAIUI
- SAP BW:CUBE size 分析
- 上海聘:SCM Java Developer/Senior DeveloperJavaDeveloper
- ORACLE ROLLUP和CUBE的使用Oracle
- MySQL ROLLUP和CUBE問題MySql
- Remote Cube的三兩事REM
- group by中cube含義解析
- Oracle PL/SQL之GROUP BY CUBEOracleSQL
- pl developerDeveloper
- [Developer] RollupDeveloper
- Cube-UI 最近做的更新UI
- 分析函式rollup||cube學習函式
- rollup cube 超匯聚函式函式
- PLSQL Developer 14SQLDeveloper
- cube ui RecycleList 不自動追加資料UI
- 輔助Cube建模的程式設計程式設計
- 分析函式 - CUBE和GROUPING SETS函式
- Apache Kylin 入門 5 – 構建 CubeApache
- Apache Kylin 入門 6 - 優化 CubeApache優化
- Apache Kylin 入門 5 - 構建 CubeApache
- Oracle的rollup、cube、grouping sets函式Oracle函式
- oracle 高階分組group by cube擴充Oracle
- oracle rollup,cube子句的應用舉例;Oracle
- PLSQL Developer 行號SQLDeveloper
- PLSQL Developer配置使用SQLDeveloper
- Developer Zone Android*DeveloperAndroid
- [Developer] Grouping setsDeveloper
- PL/SQl Developer使用SQLDeveloper
- rabbit Clients & Developer ToolsclientDeveloper
- mozilla css developer centerCSSDeveloper
- PL/SQL Developer 使用SQLDeveloper
- Oracle Developer 論壇OracleDeveloper