What is the difference between IN and Exists in Oracle?
Answers were Sorted based on User's Feedback
Answer / ram
exists improves the performance because it returns boolian
value where as 'in' is not...so exists simplyfies internal
calculations....
| Is This Answer Correct ? | 9 Yes | 1 No |
Answer / 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 |
Answer / imran
The EXISTS clause is used to check the existence of rows returned by a subquery. It returns TRUE if the subquery returns one or more rows.
The IN clause is used to filter rows based on a list of values or a subquery result set. It checks if a value matches any value in a list or subquery.
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / sri
when the condition is in a subquery then in will be used
where if there is a condition in superquery
(parent) exists will be used. Usage of IN will improve the
performance
| Is This Answer Correct ? | 0 Yes | 10 No |
What is the Router transformation?
how to remove staging area
What is confirmed fact in dataware housing?
how can one come to know wether the records loak into the target if we use update strategy
Explain the shared cache and re-cache?
What is informatica? What exactly are the practical uses in real world
How do you handle two sessions in Informatica
While importing the relational source defintion from database,what are the meta data of source U import?
What does refresh system mean, and what are its distinctive choice?
My source data like... Empid Name 10 chandra 10 sekhar I am expecting result is Empid Ename 10 Chandrasekhar How can we solve this prob?
hi friends .i designed mapping in windows but i want to run mapping in linux.should i install the server components in linux?
What are the guidelines to be followed while using union transformation?