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

I don't know why the parser says my query has a problem

Here is the query I ran and the resultant dataset. The parser says there's a problem with the query but doesn't specify the issue.

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

movie_id average 1 0.28372E1 2 0.30732E1 3 0.38333E1 4 0.27E1 5 0.36154E1 6 0.15E1 8 0.29167E1

Which challenge is this from?

1 Answer

Steven Parker
Steven Parker
231,261 Points

On these challenges, you have to be careful to not only accomplish what they require, but also do nothing else.

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

:point_right: Notice it says to group by movie_id, not select movie_id. It's only expecting to see the average, so drop movie_id from your select list and you should be good. It's an easy mistake, in real life you would rarely group by a column without selecting it also.

Spot on! Thank you so much for your explanation. So it wasn't a problem with syntax but rather my imprecise understanding of the instructions. Would have been helpful if the warning message was something along the lines of "Expecting one (1) column of output but got two instead. Check the SELECT clause of your SQL statement."

Thanks again. You ROCK!