SQL Aggregate Functions
SQL aggregate functions are used to sum, count, get the average, get the minimum and get the maximum values from a column or from a sub-set of column values.
To count the rows in the Weather table we can use the SQL COUNT aggregate function:
To get the average temperature for the Weather table use the AVG SQL aggregate function:
If you want to get the average temperature for a particular city you can do it this way:
To get the minimum value from a numeric table column, use the SQL MIN aggregate function:
To get the maximum value from a numeric table column, use the SQL MAX aggregate function:
Finally to sum up the values in the column use the SQL SUM aggregate function:
You can specify search criteria with the SQL WHERE clause for any of the above SQL aggregate functions.