设为首页 加入收藏

TOP

Oracle ROLLUP和CUBE 用法
2014-11-24 18:41:24 】 浏览:7479
Tags:Oracle ROLLUP CUBE 用法

CUBE是对GROUP BY子句的另外一 种扩充,它允许计算所有小计可能的组合,用来生成各种汇总报表。


以下介绍他们的用法


select B,c,D from Atest group by rollup(B,C,D);


相当于


select B,c,D from Atest group by B,C,D;


union all


select B,c,null from Atest group by B,C


union all


select B,null,null from Atest group by B


select B,c from Atest group by cube(B,C);


将所有 (B,C)组合的子集group by合并


相当于


select B,c from Atest group by B,C


union all


select B,null from Atest group by B


union all


select null,c from Atest group by c


union all


select null,null from Atest group by null


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇远程访问Oracle数据库 下一篇Oracle SAMPLE 语法应用

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目