August 2002
Intermediate to advanced
528 pages
10h 12m
English
ROLLUP is an extension or option available for the GROUP BY clause. It allows the user to compute subtotals and totals for groups of data. It is highly efficient and adds little overhead to the SELECT statement. A syntax template of the option is as follows:
Group By rollup (expression1, expression2)
The ROLLUP keyword will cause a cumulative subtotal row to be created for each of the expressions. When multiple expressions are placed in the parameter list, Oracle will create a grand total for the right-most expression and a subtotal for each of the left-most expressions.
The ROLLUP rows can be identified by null values. The grand-total row will have only the grand-total values. All other row values will be null. If a subtotal is computed, ...