In SQL, which clause filters aggregated group results produced by a `GROUP BY` statement?

Answer and explanation

Correct answer: A. `HAVING`

  1. Step 1: `WHERE` filters individual table rows prior to grouping.
  2. Step 2: `GROUP BY` aggregates rows into summary groups based on matching column values.
  3. Step 3: `HAVING` filters group-level summary records based on aggregate conditions (e.g. `HAVING COUNT(*) > 5`).
Answer
HAVING.
Why not the others: '`WHERE`' cannot contain aggregate functions; '`ORDER BY`' sorts results; '`DISTINCT`' removes duplicate rows.

Practise more Python Programming, Data Structures, Algorithms, Networks and Cybersecurity.

Free questions with an explanation for every one, and full timed Saudi Secondary School Certificate mock tests.