CUBE and ROLLUP
CUBE and ROLLUP are options available to queries that contain a GROUP BY clause. They are useful for applications that need to provide a changing variety of data aggregations based on varying sets of attributes or dimensions. (In the context of cubes, the word dimension is often used, either as a synonym for attribute or to describe a domain of values for an attribute.) I’ll first describe the CUBE option, and then follow with a description of the ROLLUP option, which is a special case of CUBE.
CUBE
Imagine that your application needs to provide the users with the ability to request custom aggregates based on various sets of dimensions. Say, for example, that your base data is the Orders table that I used earlier in the chapter, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access