cuberollup的异同

 

(1)、它们都有统计的作用

(2)cube生成的结果集显示了所选列中值的所有组合的聚合

(3)rollup生成的结果集显示了所选列中值的某一层次结构的聚合(只返回group by中第一个分组条件指定的列的统计行)

(4)cute的执行效率要低于rollup如图:cute66%,rollup34% 
 

cube与rollup的异同

eg:

select sno 学号,sdept 系部,avg(sage) 平均年龄

from student

where sgentle=''

group by sdept,sno

with cube
 

cube与rollup的异同  

 

select sno 学号,sdept 系部,avg(sage) 平均年龄

from student

where sgentle=''

group by sdept,sno

with rollup

 

cube与rollup的异同