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

Joining Tables and Aliasing #2 - LEFT OUTER JOIN

Quick question for the code challenge on Joining Relational Data Between Tables in SQL. Any suggestions would be appreciated.

Q: Like before, bring back the movie 'title' and genre 'name' but use the correct OUTER JOIN to bring back all movies, regardless of whether the 'genre_id' is set or not.

My command: SELECT movie.title AS movie_title, genre.name AS genre_name FROM movies LEFT OUTER JOIN genre_id ON movie.genre_id WHERE name IS NOT NULL;

2 Answers

Gregory Serfaty
Gregory Serfaty
37,140 Points

When you use a join you need 2 tables Example SELECT table1.field1, table1.field2, table2.field1 FROM table1 LEFT OUTER JOIN table2 ON table1.field_id=table2.field2 WHERE "your condition"

Makayi Lendo
Makayi Lendo
9,033 Points

select movies.title, genres.name FROM movies LEFT OUTER JOIN genres ON movies.genre_id = genres.id;