Deals Of The Week - hours only!Up to 80% off on all courses and bundles.-Close
Introduction
GROUP BY – Recap
Summary
18. Summary

Instruction

Alright, let's wrap things up!

  1. GROUP BY ROLLUP() works by creating additional rows with fewer grouping columns, as shown below:
    GROUP BY ROLLUP (A, B, C) =
    GROUP BY (A, B, C) +
    GROUP BY (A, B) +
    GROUP BY (A) +
    GROUP BY ()
    
  2. By changing the order of columns inside ROLLUP, we change the grouping levels created.
  3. Not all columns must be included inside ROLLUP. Those outside its parentheses will always be used for grouping.
  4. We can use COALESCE(column_name, substitute_value) to show the substitute_value when column_name is NULL.
  5. The GROUPING(column_name) function shows if the column_name column is used in the grouping.

Now, how about a short quiz?

Exercise

Click Next exercise to continue.