The rollup and cube Extensions of group by
For analyzing complex data, we often wish to partition data into blocks and then
calculate subtotals for these blocks. For example, we may wish to analyze sales
data by geographical region, so we want to calculate values for New England, the
Midwest, the South, etc. Such analyses are faciliatated by ORACLE’s rollup
extension of group by.
Example 5.17.10 Suppose that we need to print a report summarizing the
number of grades given in every course by every instructor. W e wish to print
subtotals for every course and then a general total for all courses. This can be
done in SQL using three subqueries (each containing a group by clause) as
follow