- A cross-product of groupings from each grouping set


    * GROUP BY grouping sets (a, b), grouping sets (c, d)


=   GROUP BY a, c ┐ 

 + GROUP BY a, d ├ cross-product of (a, b) and (c, d)

 + GROUP BY b, c │

 + GROUP BY b, d ┘ 



  ==> http://goo.gl/a9DJ4


GROUP BY grouping sets(rollup(a, b, c))


==> GROUP BY grouping sets( (a, b, c), (a, b), (a), () )


    ex) select deptno, job

from emp

group by rollup(deptno, job)

order by 1, 2;


select deptno, job

from emp

group by grouping sets(rollup(deptno, job))

order by 1, 2;


select deptno, job

from emp

group by grouping sets( (deptno, job), deptno, ())

order by 1, 2;


+ Recent posts