60-second card
COUNT, SUM, AVG
Aggregate functions turn many rows into one number.
- COUNT(*) counts rows; SUM and AVG add up and average a column.
- MIN and MAX give the smallest and largest value.
- Combine with WHERE to summarise only some rows.
SELECT COUNT(*), MAX(marks), AVG(marks) FROM students;Result
5 | 91 | 80.4Remember: Aggregates squash all the matching rows into one result.
Common mistake: Mixing an aggregate with a plain column without GROUP BY, like SELECT city, AVG(marks).