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

"Group all reviews by "movie_id" and get the average "score" and alias it as "average"

Please help i don't know where i'm lost here

3 Answers

Joel Koh
Joel Koh
3,499 Points

The question should inform which table to reference from.

Agreed. It does correlate with the treehouse_movie_db but that isn't implied ;P

It most certainly does, and it hasn't been fixed in over a year.

SELECT movie_id, AVG(score) AS average FROM reviews GROUP BY reviews.movie_id;

i finally got it: SELECT AVG(score) AS average FROM reviews GROUP BY movie_id;

This isn't working for me. You need the movie_id in the SELECT statement as well, even though this isn't explicitly said.