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.

PHP Integrating PHP with Databases Using Relational Tables Querying Multiple Tables with JOIN

Would using Join rather than left outer join to add the books table result in the same dataset?

Given we (presumably) want to add all the books from the books table and all the media items from the media table Why would we not just use a full join why does a left join work better here? Or should you always used Left Outer Join where the table on the right only has foreign keys for some but all the primary keys in the table on the left?

1 Answer

Alvin Galit
Alvin Galit
3,822 Points

From my understanding, using (Inner) Join would result in matching dataset, so only if it exists in both tables. But We want to always pull in the media information with books information being optional.