美文网首页
收集最近用到的几个oracle函数-20170616

收集最近用到的几个oracle函数-20170616

作者: bd6b5cde5ce9 | 来源:发表于2018-12-10 11:08 被阅读0次
//rollup函数:
select group_id,job,name,sum(salary) from GROUP_TEST group by rollup(group_id,job,name);
//等价于
select group_id,job,name,sum(salary) from GROUP_TEST group by group_id,job,name
union all
select group_id,job,null,sum(salary) from GROUP_TEST group by group_id,job
union all
select group_id,null,null,sum(salary) from GROUP_TEST group by group_id
union all
select null,null,null,sum(salary) from GROUP_TEST
//cube函数:
select group_id,job,name,sum(salary) from GROUP_TEST group by cube(group_id,job,name) ;
//等价于:
select group_id,job,name,sum(salary) from GROUP_TEST group by group_id,job,name
union all
select group_id,job,null,sum(salary) from GROUP_TEST group by group_id,job
union all
select group_id,null,name,sum(salary) from GROUP_TEST group by group_id,name
union all
select group_id,null,null,sum(salary) from GROUP_TEST group by group_id
union all
select null,job,name,sum(salary) from GROUP_TEST group by job,name
union all
select null,job,null,sum(salary) from GROUP_TEST group by job
union all
select null,null,name,sum(salary) from GROUP_TEST group by name
union all
select null,null,null,sum(salary) from GROUP_TEST

相关文章

网友评论

      本文标题:收集最近用到的几个oracle函数-20170616

      本文链接:https://www.haomeiwen.com/subject/cclrhqtx.html