SUM

An aggregate that adds up the non-NULL values in a group.

In more detail

Summing integer cents gives an exact total. SUM over no rows, or over only NULLs, returns NULL rather than zero; SQLite's total() or coalesce(SUM(x), 0) gives zero instead.

Example

SUM(quantity * unit_price_cents)

Related terms

Taught in

References