Aggregate functions combine multiple rows together to form a single value of more meaningful information.
COUNT() function counts the number of rows that match the specified criteria
SELECT COUNT(*)
FROM table_name;
SUM() function returns the sum of the values in a column
SELECT SUM(column)
FROM table;
MAX() and MIN() functions return the highest and lowest values in a column respectively.
SELECT MAX(column)
FROM table;
AVG() function returns the average of the values in a column
SELECT AVG(column)
FROM table;
ROUND() function takes two arguments inside the parenthesis:
SELECT ROUND(column, 0)
FROM table;
In the code above, SQL rounds the values in the column to 0 decimal places in the output.
GROUP BY is a clause used with aggregate functions to combine data from one or more columns.
HAVING limit the results of a query based on an aggregate property.