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 trialSatyam garhewal
326 PointsWhy my query is not working, can you please help me out?
I have selected the rating column and taken out the average similar in the last query and it worked in the last query but here, I am doing everything according to the tutorial but still I am not getting the solution.
2 Answers
Mustafa Baลaran
28,046 PointsHi Satyam,
You are asked to calculate the min and max values of rating column from the reviews table with movie_id = 6 and alias these two as star_min and star_max , respectively.
Please check the column you have selected, make use of MIN() and MAX() functions, use the aliases mentioned and select the correct movie_id in your WHERE clause. Then, it should be fine.
SELECT MIN(rating) AS star_min, MAX(rating) AS star_max FROM reviews WHERE movie_id = 6;
Satyam garhewal
326 PointsThank you, Mustafa, now I get what I was doing wrong, I was taking out the average of rating that the question wasn't even asking for. The Query you gave is correct- Select MIN (rating) AS star_min, MAX (rating) AS star_max from reviews where movie_id = 6;