Advertisement
Intermediate SQL & Database Querying, SQL Aggregations & Grouping

What is the difference between WHERE and HAVING?

Short answer

WHERE filters rows, HAVING filters groups.

Save SQL & Database Querying mock interview
Advertisement
AModel answer
WHERE filters rows, HAVING filters groups.
Example

Filter totals.

Real-world example
Using GROUP BY, an analyst calculated monthly revenue by region in seconds.
Likely follow-ups
  • What are aggregate functions
  • What is GROUP BY
  • What is HAVING
Related topics