Showing posts with label Difference between JOIN and INNER JOIN. Show all posts
Showing posts with label Difference between JOIN and INNER JOIN. Show all posts

Monday, March 7, 2011

Difference between JOIN and INNER JOIN

SELECT * FROM table JOIN otherTable ON table.ID = otherTable.FK

OR

SELECT * FROM table INNER JOIN otherTable ON table.ID = otherTable.FK

They function the same. INNER JOIN can be a bit more clear to read, especially if your query has other join types (e.g. LEFT or RIGHT) included in it.

Similarly with OUTER JOINs the word "OUTER" is optional, its the LEFT or RIGHT keyword that makes the JOIN an "OUTER" JOIN.

However for some reason I always use "OUTER" as in LEFT OUTER JOIN and never LEFT JOIN, but I never use INNER JOIN but rather I just use "JOIN"