SQL – Difference Between INNER JOIN and JOIN

Here is the follow up question to my earlier question SQL – Difference between != and Operator <> used for NOT EQUAL TO Operation. There was a pretty good discussion about this subject earlier and lots of people participated with their opinion. Though the answer was very simple but the conversation was indeed delightful and was indeed very informative.

In this blog post I have another following up question to all of you.

What is the difference between INNER JOIN and JOIN?

If you are working with database you will find developers use above both the kinds of the joins in their SQL Queries. Here is the quick example of the same.

Query using INNER JOIN

SELECT *
 FROM Table1
 INNER JOIN  Table2 ON Table1.Col1 = Table2.Col1

Query using JOIN

SELECT *
 FROM Table1
 JOIN  Table2 ON Table1.Col1 = Table2.Col1

The question is what is the difference between above two syntax.

Here is the answer – They are equal to each other. There is absolutely no difference between them. They are equal in performance as well as implementation. JOIN is actually shorter version of INNER JOIN.

Personally I prefer to write INNER JOIN because it is much cleaner to read and it avoids any confusion if there is related to JOIN. For example if users had written INNER JOIN instead of JOIN there would have been no confusion in mind and hence there was no need to have original question.

Here is the question back to you -

Which one of the following syntax do you use when you are inner joining two tables – INNER JOIN or JOIN? and Why?

Reference: Pinal Dave (http://blog.sqlauthority.com)

About these ads

29 thoughts on “SQL – Difference Between INNER JOIN and JOIN

  1. Hey!
    I was shocked by seeing the title of the post, first thought came to my mind was “aren’t they both the same?” and again I thought let’s see if there were any differences. All in all, a moment of anxiety!
    well, I always use the term “INNER JOIN” rather then “JOIN” in real time
    tbh, I use JOIN in my localhost when i quickly want to try out something. :)
    Best Regards
    Cheers

  2. I am using INNER JOIN because it is ANSI standard syntax & easy to migrate database from sql server to another database (oracle, mysql etc…)

  3. Hi pinal,

    Here we go, i always opt to use inner join instead of join because from the very beginning i learnt as such and got used to the same.More over it is more readable and less prone to misunderstandings.So my opinion is to use inner join instead of join syntax.

    Thanks,
    Shan

  4. Hi,
    I am mostly using INNER JOIN because it only gives clear variation for analyse joins using between tables.

    Normally, people know different types of joins. Simply they check this query is used Inner join or Outer join.

  5. I use inner join Bcz it’s same as you told no confusion and looks also good as best practice.
    join looks some thing incomplete in query. inner join easy to understand.

  6. I use Inner Join because of constant use of right, left joins functions. As you say, it is more clean to my code.

  7. I usually just use JOIN (looks like I’m in the minority :)); I’ll use INNER JOIN when I am also doing at least one other type of join in the statement.

  8. I regularly used to write queries using join instead of inner join. I know there is no difference between them. From now onwards I will set my mind to use Inner join instead of join.

  9. I use inner join for readability and also simple to avoid any errors and trouble shooting while moving from one database to another also it is fun to use “INNER JOIN’

  10. its better to use Inner Join instead of join . join is not defining the exact meaning it may be cause of confusion so try to use Inner join as a professional

  11. I use JOIN. I avoid unnecessary typing. The same thing goes for OUTER JOINS. I use LEFT JOIN. Why would I type optional unnecessary code? I don’t buy that it makes your code more readable. Can anybody honestly say that if they came across the code: select * from table1 join table2 on table1.id = table2.id that they would be confused or that it would be hard to understand? I don’t get it.

    I understand it’s an ANSI standard, but It doesn’t make sense to code for all SQL platforms. We are talking about SQL Server, not all platforms. As far as portability is concerned… how often is a company going to completely change their SQL Servers to use Oracle or MySQL??

  12. i always using ‘ join ‘ now i understood what is the diff between join and inner join
    so because of professionalism i am going to use ‘inner join’…

  13. I was shocked.! and I was curious to know what is the difference……! But got more shocked while reading the blog……..! I always use JOIN…….!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s