The ____________ clause is used to filter grouped records based on aggregate function results.
The ____________ clause is used to filter grouped records based on aggregate function results.
Solution
✅ Correct Option: 4
The HAVING clause filters groups after GROUP BY has formed them, so it can use aggregate functions such as COUNT, SUM, AVG, MAX and MIN. For example, SELECT dept, COUNT(*) FROM emp GROUP BY dept HAVING COUNT(*) > 5; keeps only departments with more than 5 employees.
WHERE: filters individual rows before grouping, so it cannot use aggregate functions.
GROUP BY: forms the groups but does not filter them.
ORDER BY: only sorts the final result.
WHERE filters rows, HAVING filters groups.
Related questions:
2025: 20 May Shift 1
2025: 13 May Shift 2
2025: 21 May Shift 1