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 (https://blog.sqlauthority.com)