COUNT, SUM, AVG, MIN and MAX
Aggregate functions turn many rows into one value.
SQL · COUNT, SUM, AVG, MIN and MAXBeginner
SELECT COUNT(*) AS orders,
SUM(total) AS revenue,
AVG(total) AS average,
MIN(total) AS smallest,
MAX(total) AS largest
FROM orders
WHERE status = 'paid';aggregatecountsumavg