Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAdrianne Padua
7,506 Points"GROUP BY" Challenge Task 1 Help
I don't understand where I went wrong with this query:
SELECT movie_id, AVG(score) AS average FROM reviews GROUP BY movie_id;
It kept giving me a "Bummer" message in return. It's asking me to group all reviews by movie_id with an average score and alias it as "average." Am I missing something here?
1 Answer
Salman Akram
Courses Plus Student 40,065 PointsHi Adrianne,
So close!
Group all reviews by "movie_id" and get the average "score" and alias it as "average".
SELECT AVG(score) AS average FROM reviews GROUP BY movie_id;
You just need to remove movie_id in the beginning, the question only asked about AVG alias with score and then group by movie_id.
-Salman
Adrianne Padua
7,506 PointsAdrianne Padua
7,506 PointsI was following along with the video and was paying more attention to what I did rather than the question. I didn't know that you could do that with the operator keywords directly (from SELECT, I mean). Thank you!
Salman Akram
Courses Plus Student 40,065 PointsSalman Akram
Courses Plus Student 40,065 PointsYou are welcome, you can definitely do anything to play around.
Happy Coding!