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

Databases

Huh? This doesn't work? SELECT AVG(score) AS average FROM movies GROUP BY movie_id; "error unknown column 'score'

Huh? This doesn't work? SELECT AVG(score) AS average FROM movies GROUP BY movie_id; "error unknown column 'score'

1 Answer

Steven Parker
Steven Parker
229,708 Points

This is a bit of a guess, since you did not link to the challenge, but if you're working on the one I'm thinking of:

:point_right: There is no score column in the movies table.

If my guess is right, you're looking for data that comes from the reviews table, so you need "FROM reviews" instead of "FROM movies".

It still didn't work... The source was https://teamtreehouse.com/library/database-foundations/sql-calculating-aggregating-and-other-functions/grouping-joining-and-cleaning-up-2

Challenge question: Group all reviews by "movie_id" and get the average "score" and alias it as "average".

My updated solution: SELECT AVG(score) AS average FROM reviews GROUP BY movie_id;

Error: Bummer! There's something wrong with your query. "error unknown column 'score'

SQL Error: Commands out of sync; you can't run this command now