WeCodeAcademy

HAVING: Filtering Groups

WHERE filters rows before grouping. HAVING filters the groups after, which is where you use aggregates.

Examplesql
Open in editor »

Combine everything: count each customer's orders and units, keep only customers with more than one order, and sort by units.

Examplesql
Open in editor »
Quick check

Which clause filters on `COUNT(*) > 1`?

Your turn: write the code

Return each city that has more than one customer, together with the number of customers, sorted by city.

Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.

Tip: use the left and right arrow keys to move between lessons.