What is the difference between IN and Exists in Oracle?
Answer Posted / pankaj
In sql server,
WHEN YOU USE 'IN', WHILE CHECKING FOR WHERE CONDITION SQL SERVER ENGINE DOES WHOLE TABLE SCAN. IF YOU USE 'EXISTS' AS SOON AS ENGINE FINDS THE REQUIRED ROW IT WILL STOP EXECUTING QUERY AND GOING FURTHER SCANNING TABLE.
In Oracle,
EXISTS is very faster than IN (when the subquery results is very large)
IN is faster than EXISTS (when the subquery results is very small)
In Example -
select ename from emp
where mgr in (select empno from emp where ename = 'KING');
Exists Example -
Select ename from emp a where exists ( select 0/null from emp b where a.mgr=b.empno and ename='KING')
| Is This Answer Correct ? | 3 Yes | 1 No |
Post New Answer View All Answers
Define update strategy?
What is a code page?
What is sq transformation?
What is the need of an ETL tool?
What are the prerequisite tasks to achieve the session partition?
Mention few power centre client applications with their basic purpose?
What is a sorter transformation?
What is option by which we can run all the sessions in a batch simultaneously?
What are the types of schemas we have in data warehouse.
What happen when you enable grid option avilable at session level ? (Ans found: Scalabily . A single session Parallelization) But how can one session is sharable among different nodes at the same time while running ?
What do you understand by term role-playing dimension?
what are the fact table & dimensional table in pharmaceutical and hospotal related products???
How you can differentiate between connected lookup and unconnected lookup?
tell me 5 session failure in real time how can you solve that in your project?
How does a rank transform differ from aggregator transform functions max and min?