Test HAVING with AVG, with OR and AND clauses, with functions and/or case when.