cude()函数是在需要对分组的数据进行统计的时候使用,
select job_id , division_id ,sum(salary) from employee group by cube(job_id,division_id);
结果如下:
job div sum(salary)
eng ope 10
eng 10
mgr bus 20
mgr ope 10
mgr sal 10
mgr sup 10
mgr 50
bus 20
ope 20
sal 10
sup 10
注意最后ope的统计。