โ† SQL & Databases
#10 most askedVery commonEasyGroup by

WHERE vs HAVING

New to Group by? Learn it from scratch first
Grouping Results with GROUP BY โ†’
๐Ÿข Asked in real interviews
No reports yet. Were you asked this? Be the first to say where.
I was asked this

Return each customer_id with at least 2 delivered orders, as customer_id and delivered_orders. Then explain why you need both WHERE and HAVING.

๐Ÿงช Practice

Write the query, then press Run tests to compare your rows with the expected result.

SQL
SELECT *
FROM orders;

Output appears here. Press Run or Ctrl/โŒ˜ + Enter.

Try it first. Struggling for a few minutes is how it sticks.