What is the exact difference b/w IN and EXIST in Oracle..?
Answer Posted / moorthy g
select ename from emp e
where mgr in (select empno from emp whereename = 'KING');
Here's the EXPLAIN PLAN for this query:
OBJECT OPERATION
---------- ----------------------------------------
SELECTSTATEMENT()
NESTEDLOOPS()
EMP TABLEACCESS(FULL)
EMP TABLEACCESS(BY INDEX ROWID)
PK_EMP INDEX(UNIQUESCAN)
This query is virtually equivalent to this:
select e1.ename from emp e1,(select empno from empwhere
ename = 'KING') e2
where e1.mgr = e2.empno;
You can write the same query using EXISTS bymoving the outer
query column to a subquery condition, likethis:
select ename from emp e
where exists (select 0 from emp wheree.mgr = empno and
ename = 'KING');
When you write EXISTS in a where clause, you'retelling the
optimizer that you want the outer query to be runfirst,
using each value to fetch a value from the inner
query(think: EXISTS = outside to inside).
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
Is it possible to create multiple domains on a single Informatica server?
What does reusable transformation mean?
How can repository reports be accessed without sql or other transformations?
SOURCE DATA IS DISPLAY IN THIS FORMATE IN TARGET . WHAT BUSINESS LOGIC WE CAN APPLY. source table target table ------------ ------------ c1 c2 c3 c1 c2 c3 -- -- -- -- -- -- 1 A J 1 2 B K 2 A 3 C L 3 B J 4 D M 4 C K 5 E N 5 E L F M N
How can we improve session performance in aggregator transformation?
What is rank index in rank transformation?
Please let me know how to make Data masking in informatica..
Explain sessions?
How can you validate all mappings in the repository simultaneously?
Is it possible to revert a global repository to local one and why?
As union transformation gives UNION ALL output, how you will get the UNION output?
What is decode in informatica?
Mention a few design and development best practices for informatica?
What is target designer and target load order?
Is stop and abort are same in informatica?