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

Development Tools

Lindsay Dassau
Lindsay Dassau
1,664 Points

Need help on question 3 of 3, Numeric and Aggregate Functions of Database Foundations

I am stuck on the question "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"."

I have tried SELECT AVG(score) AS min_score, AVG(score) AS average_all_scores FROM reviews WHERE movie_id = 1;

I've also tried SELECT MIN(score) AS min_score, MAX(score) AS max_score, AVG(score) AS average_all_scores FROM reviews WHERE movie_id = 1;

I've also made numerous alterations in hopes that I come across the correct answer. If someone could possibly point me in the right direction, it would be much appreciated. Thanks!

1 Answer

try

SELECT AVG(score) AS average_all_scores FROM reviews;

Lindsay Dassau
Lindsay Dassau
1,664 Points

Thanks Micah, you're the best! Looks like I was just trying to make it more complicated than it had to :)