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 trialDerek Morse
1,776 PointsA little Lost what am i missing
SELECT ratings, MAX(rating) AS "star_max", MIN(rating) AS "star_min" FROM reviews ORDER BY ratings;
8 Answers
Steven Parker
231,184 PointsYou're close, but:
- the table has no "ratings" (plural) field, and the instructions only asked for min and max
- you won't need ORDER BY
- you will need a WHERE clause to limit the calculations to just "Star Man" ratings
Derek Morse
1,776 Pointsthanks again
Derek Morse
1,776 Pointsdefine results please
Steven Parker
231,184 Points"ratings"
Derek Morse
1,776 PointsSELECT rating FROM reviews WHERE ID =6 MAX(rating) AS "star_max", MIN(rating) AS "star_min";
it is still off i seem to be missing somehting i am just not seeing;
Steven Parker
231,184 PointsThe functions and aliases need to be in the SELECT clause (as you had originally). And as I mentioned before, you'll want to test "movie_id" instead of "ID".
Derek Morse
1,776 PointsSELECT rating FROM reviews WHERE "movie_id" = 6, MAX(rating) AS "star_max", MIN(rating) AS "star_min"
i see what you are saying but i think there is one piece missing.
Steven Parker
231,184 PointsThe functions and aliases still need to be in the SELECT clause (as you had originally), but rating
by itself does not. And movie_id
should not be in quotes.
Derek Morse
1,776 PointsSELECT rating FROM reviews WHERE movie_id = 6 MAX(rating) AS "star_max", MIN(rating) AS "star_min";
Steven Parker
231,184 PointsI think we have a misunderstanding of the terms. To be clear, when I talk about the "SELECT clause", I mean the area after the word SELECT but before FROM.
And "rating" should not be there, but the functions and aliases should (as in your very first example).
Derek Morse
1,776 PointsSELECT rating FROM reviews, MAX(rating) AS "star_max", MIN(rating) AS "star_min" WHERE movie_id =6; still wrong
Derek Morse
1,776 Pointsgot in now thanks i see where i was messing up .. you are really helpful
Derek Morse
1,776 PointsDerek Morse
1,776 PointsSELECT rating, WHERE ID = 6 MAX(rating) as "star_max" AND MIN(rating) as "star_min" FROM reviews;
Steven Parker
231,184 PointsSteven Parker
231,184 PointsAs I mentioned before, the instructions only asked for min and max (not "rating" itself). And a WHERE clause always comes after the FROM clause. And you'll want to test "movie_id" instead of "ID".
Derek Morse
1,776 PointsDerek Morse
1,776 PointsSELECT rating FROM reviews WHERE movie_id = 6 MAX as "star_max" AND MIN as "star_min"; i still get an error most like gonna a take a break for a while
Steven Parker
231,184 PointsSteven Parker
231,184 PointsThe original code you started with had a closer SELECT clause, the min and max functions and aliases were fine but the "ratings" just didn't need to be there.