Using GROUP BY with the WITH ROLLUP Modifier
Expand your knowledge on GROUP BY with the WITH ROLLUP modifier.
We'll cover the following
MySQL provides a variety of aggregate functions. Without a GROUP BY
clause in a SELECT
statement, aggregating expressions apply to all row values of the referred table, yielding a single result row. This behavior is desirable if we want to compute the AVG()
over a set of values, for example. On the contrary, this behavior is not helpful if the underlying table’s dataset clusters into different groups. Recalling the table of our running example, CarModel
, its data points naturally fall into groups:
Get hands-on with 1400+ tech skills courses.