Practice Flashcards
Flip to reveal answersName the five SQL aggregate functions.
Track your progress — Sign up free to save your progress and get smart review reminders based on spaced repetition.
All 5 Flashcards — SQL aggregate functions
Sign up free to track progress and get spaced-repetition review schedules.
Question
Name the five SQL aggregate functions.
Answer
**COUNT**, **SUM**, **AVG**, **MIN**, **MAX** — each collapsing many rows into one value.
Question
WHERE or HAVING?
Answer
**WHERE** filters rows **before** grouping. **HAVING** filters groups **after**. A condition on an aggregate can only be HAVING.
Question
COUNT(*) or COUNT(column)?
Answer
**COUNT(*)** counts rows. **COUNT(column)** counts rows where that column is not null — the difference between 1 and 0 after a LEFT JOIN.
Question
What do aggregates do with nulls?
Answer
**AVG, SUM, MIN and MAX ignore them** — 10 rows with 3 nulls means AVG divides by 7. COUNT(*) is the exception.
Question
Which columns must appear in GROUP BY?
Answer
Every column in SELECT that is **not inside an aggregate**, or there is no single value to show for the group.
Read the notes
Full study notes for SQL aggregate functions
Topic 3.3 hub
Database programming
More from Topic 3.3
All flashcards in this topic
Computer Science exam skills
Paper structures & tips
Track your progress with spaced repetition
Sign up free — Aimnova tells you exactly which cards to review and when, so you remember everything before your IB exam.
Start Free