I have been referencing the lessons used in the Learn SQL Aggregate Functions module. in #12, it asks:
Return the total number of apps that cost 14.99.
The closest I’ve come to this is listing the id, name, & price, grouped by price, then counted manually how many have the cost 14.99. Should I be using MAX(price) in this function? I am not finding how I can COUNT the times an app has the MAX(price) or even 14.99.
SELECT id, name, price FROM fake_apps ORDER BY price;
Yes, you should use MAX() function. I would also recommend you looking into the GROUP BY instead of ORDER BY (or, you could use both but I recommend GROUP BY).
I was struggling with question 11 which seems to use the same syntax. You need to use the COUNT function:
SELECT price, COUNT(*) FROM fake_apps
WHERE price = 14.99;
Hello guys to me this is the answer, is there any way that I can check if is correct? thank you.
select count(*) from fake_apps where price = 14.99;
I believe it’s just to count we don’t need to return the price (which is 14.99 already) plus the amount of apps, is just the amount of apps at that price.