Why would you not use a join when doing a SQL query between two tables?
-
Why would one use the following query: select a.item, b.item from a,b where http://a.id = http://b.id Instead of: select a.item, b.item from a join b on http://a.id = http://b.id
-
Answer:
The two queries as presented are identical. The latter syntax has the ability to be extended to other kinds of joins. CROSS JOIN NATURAL JOIN LEFT JOIN RIGHT JOIN FULL OUTER JOIN The former syntax does not allow for that flexibility and using the former syntax type, you have to resort to database specific representations (like +=).
Amrith Kumar at Quora Visit the source
Other answers
The first is in "traditional" syntax, second in Ansi'92. It's matter of personal preferences. My favorite is Ansi because I've got used to it first. Many people prefer traditions. Btw. they aren't equal - the first's inner join [intersect of a and b], second left join [all from a, matches from b].
Jozo Kovac
I don't know any reason, other as perhaps database specific ones to ban the JOIN. In the "old days" you couldn't use a JOIN in Oracle, but other SQL languages does support it from the beginning. It's all in the database query interpreter or a JOIN is handled differently as a "key = key". So my advise is to check it for your database engine by checking the response time of both methods to see the difference. Nic;o)
Nico Altink
refer answer here :
Deepak Pandey
I always find first one easy and logically more understandable.
Mohammad Imran Khan
Related Q & A:
- How to convert a SQL query into hibernate criteria?Best solution by Stack Overflow
- How to write Join Query for two tables without foreign key in Yii2?Best solution by Stack Overflow
- Is it possible to use "undisclosed recipient" when sending a Yahoo email?Best solution by email.about.com
- Why does North america use a different voltage than Europe and Asia?Best solution by Quora
- How can I use a HDMI when my TV/Monitor doesn't have internal speakers?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.