Machine-translated by Google. Questions are authored in English.
Top

Discussion

Which SQL clause filters records after grouping ?

  • A.WHERE
  • B.ORDER BY
  • C.GROUP BY
  • D.HAVING

Answer: D

The clause is HAVING.

A query is evaluated in the order FROM, WHERE, GROUP BY, HAVING, SELECT, ORDER BY. HAVING applies a condition to each group after GROUP BY has formed it, and can therefore use aggregates, as in HAVING COUNT(*) > 5.

WHERE filters individual rows before grouping and cannot use aggregates. GROUP BY forms the groups but does not filter them. ORDER BY only sorts the result.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.