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.

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;