Why NATURAL JOIN and JOIN...USING produce different results in SQL?
-
Why doesn't the 2 queries below produce the same result? Query 1: select last_name, department_id, department_name from employees join departments using (department_id); Query 2: select last_name, department_id, department_name from employees natural join departments;
-
Answer:
The first query joins the two based on department_id and only that column. The second will join the two based on every set of columns between the two with the exact same name.
Boolean at Yahoo! Answers Visit the source
Other answers
It depends on the number of columns with coinciding names in the both tables.
Serge M
Related Q & A:
- Why can't I join chatrooms?Best solution by Yahoo! Answers
- Why can I download attachments using Yahoo Classic Mail, but not using newer Yahoo Mail?Best solution by Yahoo! Answers
- Why to Join Peace Corps?Best solution by Quora
- Why isn't my website in google search results?Best solution by Webmasters
- How do you sync itunes songs to the old ipod shuffle using a different computer?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.