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 Querying Relational Databases Set Operations What are Set Operations?

Amadou Diallo
Amadou Diallo
5,373 Points

Why don't we just use INNER JOIN instead of INTERSECT?

Why don't we just use INNER JOIN instead of INTERSECT since they do, I think, the same thing?

1 Answer

Steven Parker
Steven Parker
231,269 Points

They can have the same final result; but a JOIN adds an additional source to a single query based on specific matching criteria, and INTERSECT combines two complete queries (two SELECTs) that return identical columns.

What do you mean by an additional source to a single query?

Steven Parker
Steven Parker
231,269 Points

I mean pulling data from the columns of two (or more) tables.