Learn SQL Lesson

SUM Values

`SUM` adds the values in a numeric column. It is useful for totals like revenue, quantity, or cost.

For example:

SELECT SUM(amount) AS total_amount
FROM sales

`SUM` answers questions like “What was our total revenue?” or “How much did the West region sell?”

Like most aggregates, `SUM` ignores `NULL` values. If no rows match at all, `SUM` returns `NULL` rather than zero.

Practice challenge

Return the total sales amount for the West region as total_amount.

Open interactive editor