Rollup, Cube, Grouping
Title GROUPING_ID Author: Markus Jägle (markus.jaegle@trivadis.com) Info Technical background info (April 2002) Source from the Oracle9 i Data Warehousing Guide and the Trivadis courses New Features Oracle9 i and Advanced SQL. Introduction Oracle8 i introduced the GROUP BY functions ROLLUP and CUBE. With the same version, Oracle also offered the GROUPING function to analyze the aggregates created by the ROLLUP and CUBE functions. But since this function sometimes hogs large amounts of memory, a new function was developed with the version Oracle9 i to solve this problem: the GROUPING_ID function. ROLLUP, CUBE and GROUPING The ROLLUP function introduced with Oracle8 i allows the creation of sorted subtotals at every level of an aggregation up to the sum total. ROLLUP first calculates the aggregates specified in the GROUP BY clause. Subtotals of the higher levels are then created progressively, navigating from right to left through the grouping attribute...