CUBE « Analytical Functions « SQL Server / T-SQL Tutorial

14.2.1.Summarizing Data with CUBE
14.2.2.Using GROUPING with CUBE
14.2.3.Using the CUBE Operator
14.2.4.A summary query that includes a final summary row with 'WITH CUBE'
14.2.5.A summary query that includes a summary row for each set of groups
14.2.6.CUBE performs this rollup for every combination of grouped column values.
14.2.7.Creating the Vbase_cube View to Hide the CUBE Query Complexity