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 trial
Keith Kelly
21,326 PointsDatabase Foundations - Grouping, Joining and Cleaning Up
I am not sure if I am just having a brain fart, but I can't seem to get the correct query for the first task of the code challenge. The task is:
Group all reviews by "movie_id" and get the average "score" and alias it as "average".
My answer is:
SELECT * AVG(score) AS average FROM reviews GROUP BY movie_id;
I have also tried
SELECT movie_id AVG(score) AS average FROM reviews GROUP BY movie_id;
Any ideas where I might be going wrong?
1 Answer
Nick Clark
1,462 PointsIt probably was a brainfart, you do not need to include the wildcard * as you're already defining a scope, the correct answer would be:
SELECT AVG(score) AS average FROM reviews GROUP BY movie_id;
Hope this helps :)
Keith Kelly
21,326 PointsKeith Kelly
21,326 PointsI'll give that a shot. Thanks Nick.