SOARDO
Data Analystdata analyticsintermediate3 interactive MCQs in app

SQL aggregation

WHERE vs HAVING evaluation orderCOUNT(*) vs COUNT(col) NULL behaviorGROUP BY non-aggregated column rule

SQL GROUP BY collapses rows sharing group keys into one summary row per group using aggregates (COUNT, SUM, AVG, MIN, MAX). Remember SQL evaluation order: WHERE filters raw rows BEFORE GROUP BY; HAVING filters grouped summary rows AFTER aggregation. Notice COUNT(*) counts all rows including NULLs, whereas COUNT(col) skips NULLs, and AVG(col) ignores NULLs cleanly.

to find categories with >3 paid orders totaling >=$500, filter paid rows in WHERE, GROUP BY category, then enforce COUNT(*) > 3 AND SUM(amount) >= 500 in HAVING.
putting aggregates inside WHERE (syntax error) or putting non-aggregated columns in SELECT without listing them in GROUP BY.
SQL aggregation — Core Readingread ↗SQLBolt Interactive Lessonspractice ↗PostgreSQL Exercisespractice ↗

Practice SQL aggregation with 3 graded MCQs & written feedback.

Take SOARDO’s free 12-question diagnostic to see how strong you are across your target role and unlock adaptive daily missions.

Test yourself free on SOARDO →View full Data Analyst roadmap

More Data Analyst Study Guides