• The HAVING clause can only be used where there is a GROUP BY or where you have an aggregation. What's more, you can only, and would only want to, use HAVING where you are testing against an aggregated value. This is because by using an aggregation without explicitly using a GROUP BY clause, it is really doing the grouping (by everything) anyway under the covers. It would take a bit of head-scratching to find a valid use for this. You might want to test to check whether a subset of a table has an average more than a particular value before executing some logic--If exists (Select ... )-- However, as a good test of a developer's knowledge of SQL, it is a complete waste. You just don't need it.

    Best wishes,
    Phil Factor