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| Function | Returns | Example |
|---|---|---|
| COUNT(*) | Number of rows | SELECT COUNT(*) FROM orders |
| COUNT(column) | Rows where the column isn't NULL | COUNT(email) |
| COUNT(DISTINCT col) | Number of different values | COUNT(DISTINCT country) |
| SUM(col) | Total | SUM(stock) |
| AVG(col) | Average | AVG(price) |
| MIN(col) / MAX(col) | Smallest / largest | MAX(price) |
