Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,650 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
216,083 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 90,705 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.