Basic SQL Topics
Aggregations Part 1 — AVG()
Aggregations are some of the most useful features of SQL and very simple to learn. One of the most used aggregations is calculating an Average of a dataset (AVG). Let’s calculate the Average population estimate among the top 23 US cities in the right from California:
SELECT AVG(2022 estimate)
FROM database_table
WHERE ST = ‘CA’
The SQL statement will return the average 2022 population estimate among Los Angeles, San Diego, San Jose, and San Francisco (which equals 1,745,768)