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 data merging, data cleansing and sampling?
What is mapping debugger?
how to get flatfile containg 10 records half records one target another half another target
how to read data from website into informatica? plsss send answers ASAP thanks in advance.
What could be the possible resons of locks by user?
Hi, I have one scenario.. i want to insert 4 times (Duplicate) a row in the target. Please help me . source row: abcabc Tgt table: abcabc abcabc abcabc abcabc
If the values in a row are 1,2,3,3,4,,4,5 then how a rank transformation can rank these values
how to load only the first and last record of a flat file into the target?
How to use Normalizer transformation?
Can you please mail me a copy of Informatica Certification Exam dumps to r_balakrishna@yahoo.com
Scenario:- Below is the requirement. Source:- NAME ID Requirement RAVI 1 (no need to repeat as it ID is 1) KUMAR 3 (repeat 3 times as it ID is 3) John 4 (repeat 4 times as it ID is 4) Required Out Put:- Name ID RAVI 1 KUMAR 3 KUMAR 3 KUMAR 3 John 4 John 4 John 4 John 4 Scenario 2:- Source Data ID NAME 1,2 NETEZZA,ORACLE 3,4,5 SQL Server, DB2, Teradata Required Output:- ID NAME 1 NETEZZA 1 ORACLE 3 SQL Server 3 DB2 3 Teradata
There are 2 files, Master and User. We need to compare 2 files and prepare a output log file which lists out missing Rolename for each UserName between Master and User file. Please find the sample data- MASTER.csv ---------- Org|Tmp_UsrID|ShortMark|Rolename ---|---------|----------|------------ AUS|0_ABC_PW |ABC PW |ABC Admin PW AUS|0_ABC_PW |ABC PW |MT Deny all GBR|0_EDT_SEC|CR Edit |Editor GBR|0_EDT_SEC|CR Edit |SEC MT103 GBR|0_EDT_SEC|CR Edit |AB User USER.csv -------- Org|UserName|ShortMark|Rolename ---|--------|---------|------------ AUS|charls |ABC PW |ABC Admin PW AUS|amudha |ABC PW |MT Deny all GBR|sandya |CR Edit |Editor GBR|sandya |CR Edit |SEC MT103 GBR|sandya |CR Edit |AB User GBR|sarkar |CR Edit |Editor GBR|sarkar |CR Edit |SEC MT103 Required Output file: --------------------- Org|Tmp_UsrID|UserName|Rolename |Code ---|---------|--------|------------|-------- AUS|0_ABC_PW |charls |ABC Admin PW|MATCH AUS|0_ABC_PW |charls |MT Deny all |MISSING AUS|0_ABC_PW |amudha |ABC Admin PW|MISSING AUS|0_ABC_PW |amudha |MT Deny all |MATCH GBR|0_EDT_SEC|sandya |Editor |MATCH GBR|0_EDT_SEC|sandya |SEC MT103 |MATCH GBR|0_EDT_SEC|sandya |AB User |MATCH GBR|0_EDT_SEC|sarkar |Editor |MATCH GBR|0_EDT_SEC|sarkar |SEC MT103 |MATCH GBR|0_EDT_SEC|sarkar |AB User |MISSING Both the files are mapped through Organization, Shor_mark. So, based on each Organization, Short_Mark, for each UserName from User.csv, we need to find the Matching and Missing Rolename. I am able to bring Matching records in the output. But really I don't find any concept or logic to achieve "MISSING" records which are present in Master and not in User.csv for each UserName. Please help out guys. Let me know if you need any more information. Note:- In User.csv file, there are n number of Organization, under which n number Shortmark comes which has n number of UserName.