Reports invalid usages of SQL aggregate functions.

The following situations are considered: