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 SQL Basics Finding the Data You Want Review & Practice with SQL Playgrounds

kevin nadjarian
kevin nadjarian
1,498 Points

Select Multiple table VS INNER JOIN?

what the different from this example (selecting multiple table / same column) with a INNER JOIN?

2 Answers

First one pull all records within those two tables, then filters by the WHEREclause.

Second one, joins on record that meet the requirements on the ON clause.

Efficiency...

I ran the query and got the same results.

SELECT * FROM loans, books
WHERE loans.book_id = books.id;

SELECT * FROM loans
JOIN books ON loans.book_id = books.id;

I'm guessing they're doing it this way bc they haven't taught JOIN yet -- my sense is that it was tucked in there as a teaser, "Here's what else you'll be able to do, once you learn a little more!"