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 trialScott Bergler
2,211 PointsJOIN Challenge, Task 1
The challenge is:
We have a 'movies' table with a 'title' and 'genre_id' column
and a 'genres' table has an 'id' and 'name' column.
Use an INNER JOIN to join the 'movies' and 'genres' tables together only selecting the movie 'title' first and the genre 'name' second.
I first tried: SELECT movies.title, genres.name FROM movies INNER JOIN genres ON movies.genre_id = genres.id;
I got a "bummer" message saying, "You're not retrieving the movie 'title' first and the genre 'name' second. Use an INNER JOIN."
I then tried: SELECT movies.title, genres.name FROM movies LEFT OUTER JOIN genres ON movies.genre_id = genres.id;
This returned:
title name
Alien Sci Fi
Aliens Sci Fi
Moulin Rouge Musical
Guys and Dolls
Mama Mia
Starman
Tron
Die Hard
And I got the same bummer message. But this is what the teacher does in this video.
Then I tried this again: SELECT movies.title, genres.name FROM movies INNER JOIN genres ON movies.genre_id = genres.id;
This time it passed.
Keep in mind that I'm typing everything out here and cutting and pasting back into the challenge (open in another browser tab) so what I've posted above is what I entered, meaning that if typos or word transpositions were occurring they would have been repeated and nothing would have passed.
I'm confused. What am I missing? Was this just a hiccup in the Treehouse system when checking my entry?
1 Answer
Stone Preston
42,016 PointsSELECT movies.title, genres.name FROM movies INNER JOIN genres ON movies.genre_id = genres.id;
is definitely the correct way to do it. sometimes the challenge engine will glitch out every now and then, so thats probably what happened. If you think you have the answer correct and its not working, try refreshing the challenge and trying it again. that will usually fix it