Having question 9 fake apps


#1

.
Suppose we have the query below:

SELECT price,
ROUND(AVG(downloads))
FROM fake_apps
GROUP BY price;
Certain price points don’t have very many apps, so the average is less meaningful.

Add a HAVING clause to restrict the query to prices where the total number of apps at that price point is greater than 9.

is this correct

SELECT price,
round(AVG(downloads))
FROM fake_apps
GROUP BY 1
having count(*) > 9 ;


#2

Very good point! And yes that is correct. Tested it with this one:

SELECT price,
   ROUND(AVG(downloads))
FROM fake_apps
GROUP BY 1
HAVING COUNT(*) > 12;

#3

Can you please explain on this question?

count > 9 just eliminate 3.99 category why is that?

What does count > 9 mean here


#4

There are only 9 records @ 3.99 when grouping on price. You can test this with:

SELECT price, ROUND(AVG(downloads)), COUNT(name)
	FROM fake_apps
        GROUP BY 1;

Once you introduce HAVING COUNT (*) > 9 this 3.99 group is excluded.