SQL SERVER – Converting Subqueries to Joins

There is always more than one way to do one thing in any programming languages. In SQL Server there is always more than one way to achieve same result set. It is quite often I see that developers write subqueries in place of joining or joins in place subqueries.

SQL SERVER - Converting Subqueries to Joins left-join-null

I recommend to read my previous article SQL SERVER – Better Performance – LEFT JOIN or NOT IN?, which describes how to convert subqueries to Joins and Joins to subqueries.

SQL SERVER – Introduction to JOINs – Basic of JOINs

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?

You can read more about that over here: SQL – Difference Between INNER JOIN and JOIN

Personally, I prefer to write an INNER JOIN because it is much cleaner to read and it avoids any confusion if there is related to JOIN. For example if the 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.

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

, , ,
Previous Post
SQL SERVER – Join Better Performance – LEFT JOIN or NOT IN?
Next Post
SQL SERVER – Optimization Rules of Thumb – Best Practices

Related Posts

3 Comments. Leave new

Leave a Reply