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

Culculating the MInimum and the Maximum Values

Challenge Task 1 of 1

We're in a movie database. There's a reviews table with the columns of id, movie_id, username, review and rating.

The movie "Starman" has an id of 6. Movie ids are stored in the movie_id column. Calculate the minimum and maximum ratings for "Starman". Alias them as star_min and star_max.

Steven Parker
Steven Parker
231,128 Points

It doesn't look like you've written any code yet.

At least please give it a good-faith attempt and then ask for help if you have trouble, and be sure to show your code and provide a link to the course page you are working with.

If you're totally lost, you may want to review one or more of the videos.

SELECT MIN(ratings) AS star_min, MAX(ratings) AS star_max FROM views WHERE movie_id =6;

try this way

2 Answers

Karmen Philip
Karmen Philip
11,046 Points

SELECT MIN(rating) AS star_min, MAX(rating) AS star_max FROM reviews WHERE movie_id =6;

SELECT COUNT (movie_id), MIN(movie_id) AS star_min, MAX(movie_id) AS star_max FROM reviews GROUP BY movie_id ;

i am getting this bummer ; Your query didn't perform the correct minimum and maximum calculation.

Steven Parker
Steven Parker
231,128 Points

Did you really intend this as an answer for Maggie, or did you mean to start a new question?

If you're going to start a new question be sure to include a link to the course page as well as your code. Usually this is done for you when you use the "Get Help" button.