juniorSQL
What is HAVING clause?
Updated May 17, 2026
Short answer
HAVING filters grouped results.
Deep explanation
Unlike WHERE, HAVING works after aggregation and filters grouped data.
Real-world example
Departments with more than 5 employees.
Common mistakes
- Using HAVING without GROUP BY unnecessarily.
Follow-up questions
- Can HAVING be used without GROUP BY?
- Execution order?