The HAVING clause is used to filter groups based on which function results?
The HAVING clause is used to filter groups based on which function results?
Solution
✅ Correct Option: 2
The HAVING clause filters groups created by GROUP BY, based on the results of aggregate functions such as COUNT, SUM, AVG, MAX and MIN. For example, keeps only those groups whose total salary exceeds 50000.
WHERE filters individual rows before grouping and cannot use aggregate functions. HAVING filters groups after grouping and can.
Option 3: window functions (such as RANK or ROW_NUMBER) are not allowed directly in HAVING. They are evaluated after it, so they cannot be used to filter groups there.
Related questions:
2025: 21 May Shift 1
2025: 16 May Shift 1
2025: 13 May Shift 2
2025: 3 June Shift 2
2025: 14 May Shift 1