Differences between sub query and joins in SQL(Oracle)?
-
What are the differences between Sub query and Joins in Oracle SQL and when to use the sub query and when to use joins in queries?
-
Answer:
http://asktom.oracle.com/pls/asktom/f?p=100%3A11%3A0%3A%3A%3A%3AP11_QUESTION_ID%3A66812779016023 they (joins/subqueries) are semantically different. Use a subquery when you need no columns from the tables referenced in the subquery. Use a join when you do need some of the columns. select * from emp where deptno in ( select deptno from dept ); would be "better" than select emp.* from emp, dept where emp.deptno = dept.deptno; And remember, a subquery cannot simply be replaced by a join (and vice versa), since they often result in DIFFERENT ANSWERS. A little further reading: http://docs.oracle.com/cd/B19306_01/server.102/b14200/queries006.htm http://docs.oracle.com/cd/B19306_01/server.102/b14200/queries007.htm
Chris Schrader at Quora Visit the source
Other answers
how to sub query paper
Venkateswarao Vadlavalli
Related Q & A:
- What is the Hibernate or Criteria query for sql?Best solution by Stack Overflow
- How to convert sql query to Hibernate Criteria query?Best solution by Stack Overflow
- How to convert my SQL query to MS Access query?Best solution by Stack Overflow
- How to convert SQL query to LINQ query?Best solution by Stack Overflow
- Is SQL Server or oracle more employable?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.