Solution: Ask Questions About Questions
We'll cover the following...
We'll cover the following...
Query
SELECT type, AVG(age) AS avg_ageFROM petsGROUP BY typeHAVING AVG(age) > (SELECT AVG(age)FROM pets);
Explanation
This query finds which types of pets have an average age greater than the overall average age of all pets.
Let’s break it down step by ...