SUM

An aggregate function that adds up numeric values, ignoring NULLs.

sql
SELECT city, SUM(amount) FROM payment GROUP BY city

When to use

Used in PS 03 (total paid per city) and PS 04 (total revenue per customer), almost always with GROUP BY. Because it ignores NULLs, unpaid rentals add 0.

See PS 04.

Appears in

No references yet.