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

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

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.