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

Charles Kaelin
Charles Kaelin
4,003 Points

CODE CHALLENGE QUESTION: Grouping, Joining and Cleaning Up Question #3

For some reason, the code challenge isn't accepting my answer even though my results seem to fulfill the question. Any help would be highly appreciated... The specific question is: Challenge task of 3 Like before, group by "movie_id" on reviews, select average "score" as "average", filter out averages over 2 and do an outer join on the movies table. Bring back the movie "title" first then the average. Clean up the average and set it to 0 if null. My proposed answer is: SELECT title, AVG(score) AS average, IFNULL(AVG(score),0) AS average FROM reviews RIGHT OUTER JOIN movies ON movies.id = reviews.movie_id GROUP BY movie_id HAVING average > 2; Checking your answer...

4 Answers

The question says "filter out" averages over 2, which means that you don't want anything over 2. What you have is almost correct, just flip your > operator. The wording of the question is a bit confusing.

Charles Kaelin
Charles Kaelin
4,003 Points

Appreciate the help Ben! Your response does help to clarify the question.

Jeff Jones
Jeff Jones
8,544 Points

If it helps, that was the bit that fooled me too. It's always the little things...