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

using an inner join in database foundations

the question is: use an INNER JOIN to join the 'movies' and ''genres' tables together only selecting the movie 'title' first and the genre 'name' second.

here's my answer: SELECT * FROM movies INNER JOIN genres ON movies.title = genres.name;

treehouse says my answer is wrong, can anyone help? thanks!

5 Answers

Thank you, this is important; without knowing the table names, it would be difficult to arrive at a solution.

that worked...thank you, juliette!!!

Hi Bill,

It sounds like it's asking you to select two fields, title and name. Your current select uses the wildcard asterisk so it is selecting everything.

The Inner Join should also be done where there is a match between the columns in both tables, as a means to link the two. So without seeing the structure of the tables, I'd guess the select statement should be something like:

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

thank you, lindsay!

Juliette Tworsey
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Juliette Tworsey
Front End Web Development Techdegree Graduate 32,425 Points

Hi Biil,

Here is a brief explanation to augment Lindsay's answer above:

You need to SELECT specific columns (movies.title and genres.name....title and name are both columns in the movie table) FROM a table (movies) and INNER JOIN them to another table (genres) ON specific id matching a value (movies.genre_id and genres.id).

thank you lindsay and juliette for your responses...however, when i try lindsay's answer, i get the following error message:

You're not retrieving the movie 'title' first and the genre 'name' second. Use an INNER JOIN.

Hi Bill,

Can you link to the course or challenge?