Oracle学习之查询语句

select deptno,job,avg(sal) from emp group by deptno,job order by deptno;
select deptno,job,avg(sal) from emp group by cube (deptno,job) order by deptno;
select deptno,job,sum(sal),grouping(deptno),grouping(job)
from emp
group by rollup(deptno,job) order by deptno;

select deptno,job,sum(sal) from emp group by rollup((deptno,job));
select deptno,job,sum(sal) from emp group by cube((deptno,job));
select deptno,job,mgr,sum(sal) from emp
group by grouping sets(deptno),grouping sets(job,mgr);
select deptno,job,avg(sal) from emp group by grouping sets(deptno,job);
select deptno,job,mgr,sum(sal) from emp
group by deptno,rollup(job,mgr);
select deptno,job,mgr,sum(sal) from emp
group by deptno,cube(job,mgr);

 

posted @ 2016-03-27 00:44  道心不可练  阅读(229)  评论(0编辑  收藏  举报