BUILDS ON
TOPICS
#13
Aggregate Functions
Collapse a whole column to one number with COUNT, SUM, AVG, MIN and MAX, predict how each treats NULLs, and read several aggregates from one SELECT as a single summary row.
12 min
#14
GROUP BY
Split rows into one group per distinct value, predict how grouping changes the result row count, and apply the rule that every selected column must be grouped or wrapped in an aggregate.
14 min
#15
HAVING vs WHERE
Filter rows with WHERE before grouping and whole groups with HAVING after, route each condition by what it reads, and know why an aggregate is rejected in WHERE but legal in HAVING.
11 min
#16
COUNT(*) vs COUNT(col)
Pick between COUNT(*), COUNT(col), and COUNT(DISTINCT col), read the gap each leaves when the column holds NULLs or repeats, and ride the same skip-NULL rule to count only the rows that meet a condition.
10 min
UNLOCKS