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!

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

MySQL: Stage 7 Calculating...

The question asks: Like before, group reviews by "movie_id", get the average "score" as "average" and filter out any averages over 2.

My answer is: select avg(score) as average from reviews group by movie_id having average > 2;

which is flagged as incorrect.

If I type it into MySQL Workbench it works as expected.

Does anyone see the problem? Thanks!

2 Answers

Fraser Boag
Fraser Boag
6,381 Points

If i'm not mistaken, your query would only display reviews which have a score greater than 2 - whereas the question asks for these to be filtered out (ie only display results with an average of less than or equal to 2). I think this may be the problem, however I'm not very familiar with HAVING so I am guessing a bit at its usage (based on my understanding of WHERE).

That was my problem - thanks!