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

Adrianne Padua
Adrianne Padua
7,506 Points

"GROUP BY" Challenge Task 1 Help

I don't understand where I went wrong with this query:

SELECT movie_id, AVG(score) AS average FROM reviews GROUP BY movie_id;

It kept giving me a "Bummer" message in return. It's asking me to group all reviews by movie_id with an average score and alias it as "average." Am I missing something here?

1 Answer

Hi Adrianne,

So close!

Group all reviews by "movie_id" and get the average "score" and alias it as "average".

SELECT AVG(score) AS average FROM reviews GROUP BY movie_id;

You just need to remove movie_id in the beginning, the question only asked about AVG alias with score and then group by movie_id.

:smile:

-Salman

Adrianne Padua
Adrianne Padua
7,506 Points

I was following along with the video and was paying more attention to what I did rather than the question. I didn't know that you could do that with the operator keywords directly (from SELECT, I mean). Thank you!

You are welcome, you can definitely do anything to play around.

Happy Coding!