midT-SQL
What is HAVING clause?
Updated May 17, 2026
Short answer
Filters grouped results.
Deep explanation
Applied after GROUP BY for aggregate filtering.
Real-world example
Departments with more than 5 employees.
Common mistakes
- Using HAVING instead of WHERE.
Follow-up questions
- Order of execution?
- Can HAVING be used without GROUP BY?