Learn SQL Lesson
WHERE Filters Before GROUP BY
`WHERE` removes individual rows before any grouping or aggregation happens.
If you write:
SELECT region, SUM(amount) AS total_amount
FROM sales
WHERE amount >= 900
GROUP BY region
only sales with amount >= 900 participate in the grouped totals. Smaller rows are gone before `GROUP BY` ever runs.
This is why `WHERE` is for row-level filters, not group-level filters.
Practice challenge
Only consider sales with amount >= 900. Then return region and total_amount, ordered by region.