Interviews4 answers
What is good option to use in SQL and WHY? 1) JOIN 2) SUB QUERY
4 Answers
Subquery can be slower than join, but subquery can increase readability of code.
Dhara PatelPosted Nov 18, 2019, 12:12 AM EST
Usually joins will work faster than inner queries, but in reality it will depend on the execution plan generated by SQL Server. No matter how you write your query, SQL Server will always transform it on an execution plan. If it is “smart” enough to generate the same plan from both queries, you will get the same result.
In more complex queries, I find joins much easier to read than sub-queries. sub-queries turn into a bowl of noodles in my head.
SANJAY SHARMAPosted Oct 22, 2019, 12:16 AM EDT
JOIN is better option.
Faster than subquery.
Tushar DikshitPosted Oct 8, 2019, 9:31 AM EDT



