SUM adds exact integer cells.

highlighted = computed this step

Sum integer values

SUM adds the integer quantity cells inside each bucket.

sum integer cells\text{sum integer cells}

Add quantities

The output has 3 grouped sums.

sum rows=3\text{sum rows}=3

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

Sum integer values: base rowssourceRowidkindqty01book212game123book334game445tool1 group by columnscolumnkind aggregate specsopcolumnassum_intqtytotal_qty group bucketskeysourceRowsrowCount[book][0, 2]2[game][1, 3]2[tool][4]1 aggregate rowskeytotal_qty[book]5[game]5[tool]1 having keep/dropkeystatusreason[book]keepno_having[game]keepno_having[tool]keepno_having output rowskeytotal_qty[book]5[game]5[tool]1 group factsfactvaluerowCount5groupByColumnCount1groupCount3aggregateCount1outputGroupCount3havingnonehiddenGroupsno

Read the source rows

The bucket table shows exactly which source rows contributed to each total.

sum from bucket rows\text{sum from bucket rows}

Summary

No floats or averages are modeled in this book.

integer SUM only\text{integer SUM only}