Oracle: Rollup Query

ROLLUP enables a SELECT statement to calculate multiple levels of subtotals across a specified group of dimensions. It also calculates a grand total. ROLLUP is a simple extension to the GROUP BY clause, so its syntax is extremely easy to use. The ROLLUP extension is highly efficient, adding minimal overhead to a query.

select
    deptno,
    job,
    sum(sal)
from
    scott.emp
group by
    rollup(deptno,job);

Output

5 comments:

  1. good info
    can u explain cube also??

    ReplyDelete
  2. The given post explains the term ROLLUP used in Oracle. You get the exact definition of the term and why it is used for. The syntax for Rollup is also written which is very easy to understand. Given is the example for clearing the point.

    ReplyDelete
  3. This is super cool. Thanks.

    ReplyDelete