Aggregates can appear in the following types of clauses:
- The WHERE clause of an ABORT statement to specify an abort condition.
But an aggregate function cannot appear in the WHERE clause of a SELECT statement.
- A HAVING clause to specify a group condition.