Guided Notes

MIN, MAX, COUNT, AVG & SUM

Summarizing data with aggregate functions, counting rows and distinct values, rounding, and how NULLs affect results.

Aggregate functions

Slide 1 / 5
FunctionReturnsExample
COUNT(*)Number of rowsSELECT COUNT(*) FROM orders
COUNT(column)Rows where the column isn't NULLCOUNT(email)
COUNT(DISTINCT col)Number of different valuesCOUNT(DISTINCT country)
SUM(col)TotalSUM(stock)
AVG(col)AverageAVG(price)
MIN(col) / MAX(col)Smallest / largestMAX(price)
← INSERT, UPDATE & DELETE