简体   繁体   English

在Oracle SQL中用汇总替换多维数据集

[英]Replacing cube with rollup in Oracle SQL

A homework assignment I have asks the following question: 我进行的一项家庭作业提出以下问题:

Show how to express \\group by cube (a, b, c, d)" using rollup rather than cube. 显示如何使用汇总而不是多维数据集来表示\\ group by cube(a,b,c,d)“。

I really don't have the faintest clue how to do this. 我真的不知道该怎么做。 Where would I start or where could I look for some help? 我从哪里开始或在哪里可以寻求帮助?

Since this is an assignment I will point you to a very good article about GROUP BY, ROLLUP and CUBE by Rob van Wijk . 由于这是一项任务,我将为您指出Rob van Wijk 撰写的关于GROUP BY,ROLLUP和CUBE非常好的文章

The two equivalence relations relevant here would be: 这里相关的两个等价关系为:

 GROUP BY CUBE ( set1, …, setn )
 ≡ GROUP BY GROUPING SETS (all possible combinations between () and (set1, …, setn) )

and the analogy with the cartesian product: 以及与笛卡尔积的类比:

GROUP BY a, ROLLUP(b)
≡ GROUP BY GROUPING SETS (a), GROUPING SETS ((b), ())
≡ GROUP BY GROUPING SETS ((a,b), (a))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM