AI engineering glossary · SQL databases
What is HAVING?
HAVING: A clause that filters groups after aggregation, using conditions on aggregate results. WHERE cannot do this because it runs before grouping. Use WHERE for row filters and HAVING for group filters.
HAVING: an example
GROUP BY city HAVING COUNT(*) > 100 keeps only cities with more than 100 customers.
Related terms
More SQL databases terms
Where you learn it
HAVING is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.