Question 6 Fake_Apps


#1

Question 6 asks you to return the average price for each category.

My attempt: select category, avg(price) from fake_apps order by category;

I'm only returning the average of the News category.


#2

@cucumberslumber

Can we have the link to the exercise please?


#3

https://www.codecademy.com/en/courses/learn-sql/projects/fakeapps


#4

@cucumberslumber

Do you mean this link https://www.codecademy.com/en/courses/learn-sql/lessons/aggregate-functions/exercises/min?action=lesson_resume ? Because yours seems to generate an 404 HTTP error.


#5

Try this: https://www.codecademy.com/en/courses/learn-sql/projects/fakeapps I just refreshed the page.


#6

@cucumberslumber

The link still doesn't work. Is it something reserved for codecademy pro?


#7

Yes, this is a project from pro.


#8

@cucumberslumber

Ahh, I understand now. I'm not yet a codecademy pro but try this:

SELECT AVG(price) FROM fake_apps ORDER BY category

#9

I tried that on my own, but I put it in just now and didn't pull anything. I appreciate the attempt!


#10

@cucumberslumber

So does your code works now?


#11

Still having trouble with that one.


#12

@cucumberslumber

Wait... Try this one:

SELECT AVG(price) FROM fake_apps WHERE category

#13

I made the same mistake at the first time too! You should use GROUP BY instead of ORDER BY!!!

So the answer should be:
SELECT category, AVG(price)
FROM fake_apps
GROUP BY category;


#14

This is correct. :wink: !


#16