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

Development Tools Database Foundations SQL Calculating, Aggregating and Other Functions Grouping, Joining and Cleaning Up

Shahriar Ayoubi
PLUS
Shahriar Ayoubi
Courses Plus Student 9,090 Points

The first challenge question on the Grouping, Joining and Cleaning up

The question asks to group by movie_id and get average score. All my attempts fail the check. Can I have a hint as to what is wrong with this answer? select movie_id, AVG(score) AS average from reviews group by movie_id;

It is flagged as incorrect and I cannot get past this question.

I don't usually give averages but this one is VERY stupid and poorly worded - it in fact SHOULD NOT WORK .

Select AVG(score) AS average from review GROUP BY movie_id

Yup - you didn't need to include movie_id

I came up with the same thing as you and could not figure out what the problem was: SELECT movie_id, AVG(score) AS average FROM reviews GROUP BY movie_id;

2 Answers

Also got hung up with the "SELECT movie_id" bit. Small correction to John's answer ( "reviews" instead of "review"):

Select AVG(score) AS average from reviews GROUP BY movie_id