After groups have been established, SQL applies predicates in the ________ clause, allowing aggregate functions to be used.
Asked In:
BPSC TRE 3.0
Options
-
A.
HAVING
-
B.
GROUP BY
-
C.
WITH
-
D.
More than one of the above
-
E.
None of the above
Correct Answer (Detailed Explanation is Below)
A.
HAVING
Detailed Explanation
- HAVING clause: Filters groups after GROUP BY has formed them.
- Aggregate functions: HAVING can use functions such as COUNT(), SUM(), AVG(), MIN() and MAX() in its conditions.
- Example: SELECT department_id, COUNT(*) FROM employees GROUP BY department_id HAVING COUNT(*) > 5;
OOps! You are currently offline.