Back to Topic 3.3 — Database programming
3.3.4Computer Science5 flashcards

SQL aggregate functions

Practice Flashcards

Flip to reveal answers
Card 1 of 53.3.4
3.3.4
Question

Name the five SQL aggregate functions.

Click to reveal answer

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.

Card 1definition

Question

Name the five SQL aggregate functions.

Answer

**COUNT**, **SUM**, **AVG**, **MIN**, **MAX** — each collapsing many rows into one value.

Card 2comparison

Question

WHERE or HAVING?

Answer

**WHERE** filters rows **before** grouping. **HAVING** filters groups **after**. A condition on an aggregate can only be HAVING.

Card 3comparison

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.

Card 4concept

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.

Card 5concept

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.

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