Aggregations Part 3 — SUM()

Instead of the average population for California cities in the table on the right, say we wanted to find the total population among the four cities

SELECT SUM(2022 estimate)

FROM database_table

WHERE ST = ‘CA’

  • Now, the SQL statement returns the total 2022 population estimate among Los Angeles, San Diego, San Jose, and San Francisco (6,983,070)