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

the challenge is unclear

I have this challenge: Group all reviews by "movie_id" and get the average "score" and alias it as "average".

This is my answer: SELECT AVG(score) AS average FROM movies GROUP BY movie_id;

And i get this message: SQL Error: Unknown column 'score' in 'field list'

Chris Shaw
Chris Shaw
26,676 Points

Hi Tomas,

Which challenge is this for?

Hi Chris, It's Grouping Joining and Cleaning up, task 1 of 3

2 Answers

Steven Parker
Steven Parker
229,732 Points

The challenge says: Group all reviews by "movie_id" and get the average "score" and alias it as "average".

:point_right: Note that the table name is reviews, not movies.

The database also contains a movies table, but that one has no score column.

Jonathan Grieve
MOD
Jonathan Grieve
Treehouse Moderator 91,252 Points

I think that answer is correct. I'm making one or 2 assumptions here that the fields are correct.

I had an issue earlier when I attempted to copy a line of SQL code from one line that passed a task, to another because the questions were similar. The other challenge wouldn't pass even though it was right.

In order to pass, I had to manually type out the answer again. So however "painful" it might be try this again for your question and see it passes. It could easily be a challenge bug. :-)

Hi Jonathan, I had similar problems in the past. Unfortunately this is not the case I typed manually few times I got the same error.