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

Micah Dunson
Micah Dunson
34,368 Points

Answer works in browser but not Treehouse challenge?

I don't know what the challenge is asking for ?

Challenge Task 3 of 3

In the "reviews" table, with the column "score", return the average of all movie's joint scores. Alias the aggregated column as "average_all_scores".

My Answer

SELECT MIN(score) AS minimum_score, MAX(score) AS maximum_score, AVG(score) AS average_all_scores FROM reviews;

My answer works fine in the browser however treehouse indicates it is wrong

Treehouse: Bummer! There's something wrong with your query, alias the AVG(score) AS min_score and SELECT from the 'reviews' table.

Micah, can you give us a link to the challenge. Your SQL does look OK, but it's not clear what the challenge is asking you to do, so I can't tell what it wants different.

3 Answers

Micah, thanks. The problem is that you have sort of combined the queries for Tasks 2 and 3 together. But the editor wants each one done separately, and not combined with any other. So Task 3 would be:

SELECT AVG(score) AS average_all_scores FROM reviews;
Micah Dunson
Micah Dunson
34,368 Points

You're absolutely right! I'm thinking too hard lol. Thanks