Use the aggregate function `SUM()` to find the sum (total) of a set of values.

- Type:
expr is a column name, literal, or numeric expression. The result’s data type is at least as precise as the most precise data type used in expr. Listing 6.3 and Figure 6.3 show some queries that involve
`SUM(expr)`

`SUM()`. The first query returns the total advances paid to all authors. The second query returns the total sales of books published in 2000. The third query returns the total price, sales, and revenue (= price × sales) of all books. Note a mathematical chestnut in action here: “The sum of the products doesn’t (necessarily) equal the product of the sums.”

✓ Tips

`SUM()`works with only ...

Start Free Trial

No credit card required