SQL GROUP BY & Agregat Playground

The village office’s monthly tally: the register grouped by colour, COUNT/SUM/AVG on the board, HAVING striking groups. Run by a real SQLite. An interactive…

Why it matters

GROUP BY and aggregates are the backbone of SQL reports and analytics. The two confusions that always come up, "why can’t a plain column sit in SELECT with GROUP BY" and "when WHERE, when HAVING", clear up once you see the rows go into baskets and HAVING strike out whole baskets.

The key idea

HAVING filters groups after aggregation, WHERE filters rows before it

Common mistakes

Try it in this playground