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

Development Tools

Nancy Melucci
PLUS
Nancy Melucci
Courses Plus Student 35,157 Points

The code I am using for the challenge (addendum to my previous message about the code challenge for Joining Tables/alias

SELECT*FROM movies INNER JOIN genres ON movies.title = genres.name;

this is what I used for my response and then I get the error message from the code challenge that I need to "put movies first"....But I don't know how to do that other than putting the word FIRST in...and this is not demonstrated in the video??

2 Answers

You need show only two fields. First - movie "title" Second - genre "name"

You need join movies and genres tables, on the fields movie "genre_id" and genres "id"

Alex Kenny
Alex Kenny
7,761 Points

Hi Nancy,

I'm not sure I understand the error message you've described in your post but let me try and help you solve the problem anyway.

First you need to select movies.title and genres.name instead of * (which means everything, all columns from your table) in your select statement.

You're almost right with your INNER JOIN but to make it clear, you'll notice the movies table has a column movies.genre_id and the genres table has a column genres.id. These two columns are equal as in they both refer to the same value so it would be the common factor you would join the two tables with. The movies table uses the genre_id to link the movie to the particular genre. So you'll need to make your join look something like this: INNER JOIN genres ON movies.genre_id = genres.id. You can see this in the code snippet I've made for you below.

SELECT movies.title, genres.name FROM movies INNER JOIN genres ON movies.genre_id=genres.id;

Hope that helps. Good luck!