CBSE Class 12 Computer Science Question 25 of 91

Grouping Records, Joins in SQL — Question 3

Back to all questions
3
Question

Question 3

Aggregate functions can be used in the select list or the ............... clause of a select statement. They cannot be used in a ............... clause.

  1. Where, having
  2. Having, where
  3. Group by, having
  4. Group by, where
Answer

Having, where

Reason — Aggregate functions can be used in the select list or the HAVING clause of a select statement. But they cannot be used in a WHERE clause. The reason for this is that the WHERE clause filters rows before any grouping or aggregation occurs, while HAVING clause applies conditions to groups after the data has been grouped using the GROUP BY clause.