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
How do you load only null records into target?
Under what condition selecting sorted input in aggregator may fail the session?
can anyone suggest best free Talend data integration training online
Tell me any other tools for scheduling purpose other than workflow manager pmcmd?
Suppose we configure sorter transformations in the master and detail pipelines with the following sorted ports in order: item_no, item_name, price. When we configure the join condition, what are the guidelines we need to follow to maintain the sort order?
I have worked on Informatica 7.1.1. I want to know the answer for the below question. Target is not created initially.Then how to take the DDL script from the source and run the Mapping by creating the Target dynamically?Is it possible by SQL Transformation?
How to join three sources using joiner?
What are different types of transformations available in informatica?
Explain in detail about scd type 1 through mapping.
difference between repository database and repository service?
Give one example for each of conditional aggregation, non-aggregate expression, and nested aggregation?
How can we delete duplicate rows from flat files?
What is decode in static cache?
explan ur project architecture?
What is meant by target load plan?