Which SQL clause is used to filter aggregated group records after a `GROUP BY` statement has been applied?

Answer and explanation

Correct answer: C. `HAVING`

  1. Step 1: In SQL execution order, the `WHERE` clause filters individual rows before grouping occurs.
  2. Step 2: To filter grouped results based on aggregate functions (e.g., `COUNT(*) > 5`), the `HAVING` clause is mandatory.
Answer
`HAVING`.
Why not the others: '`WHERE`' filters rows prior to aggregation; '`ORDER BY`' sorts the output rows; '`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.