WHERE filters rows before SQL creates the groups. HAVING filters the groups after SQL calculates COUNT, SUM, or another aggregate.
Both clauses can remove data, but moving a condition between them can change the question we answer. A status filter in WHERE might remove orders that should still be included in a customer’s total.
In this module, we’ll compare two similar requests. The first needs customers with at least two total orders and one delivered order. The second needs customers with at least two delivered orders.
Upgrade to continue with the remaining modules and keep the full set of course resources.



