...

/

Solution: Only Keep Interesting Groups

Solution: Only Keep Interesting Groups

We'll cover the following...

Query

SELECT city, AVG(age) AS avg_age
FROM people
GROUP BY city
HAVING AVG(age) < 28;

Explanation

This query finds the average age of people in each city, but only shows cities where the average age is less than 28. ...