Grouped output rows keep the key next to aggregate values.

highlighted = computed this step

Group key plus aggregate

A grouped output row keeps the group key next to its aggregate values.

key plus facts\text{key plus facts}

Show both aggregates

There are 2 aggregate columns across 3 output groups.

aggregates=2\text{aggregates}=2

Grouping examples are tiny finite table transforms; SQL dialects, NULLs, AVG/rounding, planner behavior, indexes, performance, and product behavior are out of scope.

Group key plus aggregate: base rowssourceRowidkindqty01book212game123book334game445tool1 group by columnscolumnkind aggregate specsopcolumnascount_rowsrowsnsum_intqtytotal_qty group bucketskeysourceRowsrowCount[book][0, 2]2[game][1, 3]2[tool][4]1 aggregate rowskeyntotal_qty[book]25[game]25[tool]11 having keep/dropkeystatusreason[book]keepno_having[game]keepno_having[tool]keepno_having output rowskeyntotal_qty[book]25[game]25[tool]11 group factsfactvaluerowCount5groupByColumnCount1groupCount3aggregateCount2outputGroupCount3havingnonehiddenGroupsno

Read the output rows

Each output row is a key with its recomputed count and sum.

grouped row\text{grouped row}

Summary

The output is not a copy of an input row; it is built from a bucket.

aggregate output\text{aggregate output}