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
can anyone explain me about retail domain project in informatica?
How can one identify whether mapping is correct or not without connecting session?
What are connected or unconnected transformations?
What is meant by lookup transformation? Explain the types of lookup transformation?
What is the way to execute pl/sql script using informatica mapping?
What are the issues you have faced in your project? How did you overcome those issues?
How to start a workflow using pmcmd command?
in staging we are merging the data and remove the inconsistants data that type of situation what u will done and type of functions u can use
What are junk dimensions?
What are the components of workflow manager?
What is informatica?
in u flatfile some of fact records are missed then u load the diminision records are not if u load diminsion records what about fact table records
What are the differences between a connected lookup and unconnected lookup?
How to handle decimal places while importing a flatfile into informatica?
What is status code in informatica?