Home › SQL Tutorial › SQL aggregate functions
SQL aggregate functions
MIN, MAX, COUNT, SUM and AVG.
Aggregate functions turn many rows into one value: MIN, MAX, COUNT, SUM and AVG. COUNT(*) counts rows. They ignore NULL values (except COUNT(*)).
Example code
SELECT MIN(amount) AS lowest,
MAX(amount) AS highest,
COUNT(*) AS orders,
SUM(amount) AS total,
AVG(amount) AS average
FROM Orders;