Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
I'm doing the final practice for this section and it asked for the Max & Min for each movie. I got those but how do I get the movie_id for both Max & Min? I added movie_id to my query and it only showed one ID but Max & Min are 2 different IDs. Thanks!!
Jonathan GrieveTreehouse Moderator 90,825 Points
min() are SQL methods that manipulate data that already exists.
What's happening is that the movie table is a foreign key table, which means it has a "many" relationship. The
movie_id is a foreign key column so it can appear more than once. So you should only need to select the
movie_id once in your query in order to get the min() and max() data
My apologies as I may have asked the question wrong. How do I get the movie_id to show with the Min() and the Max()? I did get the Min () and Max() data but I could not get the ID for each. They are two different IDs but it only showed one.