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.

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!