GROUP BY

Grouping rows, aggregating per group, HAVING, and WHERE versus HAVING.

3 notes

Notes

SQL

GROUP BY Fundamentals

GROUP BY collapses rows into one row per distinct key. Learn the single rule that governs the select list and how NULLs are grouped.

Read more
SQL

HAVING, and WHERE vs HAVING

HAVING filters groups after aggregation, WHERE filters rows before it. Learn when each applies, why using both is usually correct, and which is faster...

Read more