Difference between  exists and in operators in oracle?

what is difference between exists and in operators in oracle?
what is faster and why?

Malli wrote:
what is difference between exists and in operators in oracle?
what is faster and why?Is this a homework question?
Have you done any tests yourself to see which is faster?

Similar Messages

  • What is the difference between exists and in

    hi all
    if i have these queries
    1- select ename from emp where ename in ( select ename from emp where empno=10)
    and
    2- select ename from emp where exists ( select ename from emp where empno=10)
    what is the difference between exists and in is that only when i use in i have to bring the field name or what.... i mean in a complex SQL queries is it will give the same answer
    Thanks

    You get two entirely different result sets that may be the same. Haah! What do I mean by that.
    SQL> select table_name from user_tables;
    TABLE_NAME
    BAR
    FOO
    2 rows selected.
    SQL> select table_name from user_tables where table_name in (select table_name from user_tables where table_name = 'FOO');
    TABLE_NAME
    FOO
    1 row selected.
    SQL> select table_name from user_tables where exists(select table_name from user_tables where table_name = 'FOO');
    TABLE_NAME
    BAR
    FOO
    2 rows selected.So, why is this? the WHERE EXISTS means 'if the next is true', much like where 1=1 being always true and 1=2 being always false. In this case, where exists could be TRUE or FALSE, depending on the subquery.
    WHERE EXISTS can be useful for something like testing if we have data, without actually having to return columns.
    So, if you want to see if an employee exists you might say
    SELECT 1 FROM DUAL WHERE EXISTS( select * from emp where empid = 10);
    If there is a row in emp for empid=10, then you get back 1 from dual;
    This is what I call an 'optimistic' lookup because the WHERE EXISTS ends as soon as there is a hit. It does not care how many - only that at least one exists. It is optimistic because it will continue processing the table lookup until either it hits or reaches the end of the table - for a non-indexed query.

  • Difference between exists and createIf

    Hi all,
    In Node functions we are having createIf and exists. what is the difference between createIf and exists? Where we have to use createIf and where we have to use exists?
    Thanks
    Sridhar

    Hi Sridhar
    Source Node --- Exists ---target Node ..... this says that the target node will be created if and only if the source node (may be source occurences is 0...1)through which you are mapping exists or not.. If it than target node will be created if not than it wont be created ...
    Source node -
    creatIf---target Node ...... this says that there will be some condition in source side ...if that condition is true than create the target node otherwise do not create
    Regard
    Abhi

  • Difference between internal and external organizations in oracle hr

    Hello,
    While creating an organization, when do we use Internal and External? Basically whats the difference between these two options in the Work Structure screen while defining organizations?
    Thank You
    Kumar

    Hello,
    Just to add on information.
    Internal organizations are such as departments, divisions, and sections
    External organizations are such as benefits carriers, tax authorities, and recruiting agencies.Organization classification Payee Organization when defining an external organization that is the recipient of a third party payment from an employee, for example a court-ordered payment. You can then select this organization on the Personal Payment Method window when entering a third party payment method.
    Generally we do not tag employees(Organization classification HR Organization) to external organizations.
    Regards,
    Saurabh

  • Difference between ANY and ALL operators

    I am learning the basics of ANY and ALL operators.
    Retrieving all employees in Dept 30 whose sal is greater than ANY employees in Dept 20
    SQL> SELECT * FROM EMP;
         EMPNO ENAME           JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7369 SMITH           CLERK           7902 17-DEC-80        800                    20
          7499 ALLEN           SALESMAN        7698 20-FEB-81       1600        300         30
          7521 WARD            SALESMAN        7698 22-FEB-81       1250        500         30
          7566 JONES           MANAGER         7839 02-APR-81       2975                    20
          7654 MARTIN          SALESMAN        7698 28-SEP-81       1250       1400         30
          7698 BLAKE           MANAGER         7839 01-MAY-81       2850                    30
          7782 CLARK           MANAGER         7839 09-JUN-81       2450                    10
          7788 SCOTT           ANALYST         7566 19-APR-87       3000                    20
          7839 KING            PRESIDENT            17-NOV-81       5000                    10
          7844 TURNER          SALESMAN        7698 08-SEP-81       1500          0         30
          7876 ADAMS           CLERK           7788 23-MAY-87       1100                    20
         EMPNO ENAME           JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7900 JAMES           CLERK           7698 03-DEC-81        950                    30
          7902 FORD            ANALYST         7566 03-DEC-81       3000                    20
          7934 MILLER          CLERK           7782 23-JAN-82       1300                    10
    14 rows selected.
    SQL> SELECT * FROM EMP WHERE DEPTNO=20;
         EMPNO ENAME           JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7369 SMITH           CLERK           7902 17-DEC-80        800                    20
          7566 JONES           MANAGER         7839 02-APR-81       2975                    20
          7788 SCOTT           ANALYST         7566 19-APR-87       3000                    20
          7876 ADAMS           CLERK           7788 23-MAY-87       1100                    20
          7902 FORD            ANALYST         7566 03-DEC-81       3000                    20
    SQL> SELECT * FROM EMP WHERE DEPTNO=30;
         EMPNO ENAME           JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7499 ALLEN           SALESMAN        7698 20-FEB-81       1600        300         30
          7521 WARD            SALESMAN        7698 22-FEB-81       1250        500         30
          7654 MARTIN          SALESMAN        7698 28-SEP-81       1250       1400         30
          7698 BLAKE           MANAGER         7839 01-MAY-81       2850                    30
          7844 TURNER          SALESMAN        7698 08-SEP-81       1500          0         30
          7900 JAMES           CLERK           7698 03-DEC-81        950                    30
    6 rows selected.
    SQL> SELECT * FROM EMP
      2  WHERE SAL>ALL
      3  (SELECT SAL FROM
      4  EMP WHERE DEPTNO=20)
      5  AND DEPTNO=30;
    no rows selected
    SQL> SELECT * FROM EMP
      2   WHERE SAL>ANY
      3   (SELECT SAL FROM
      4   EMP WHERE DEPTNO=20)
      5   AND DEPTNO=30;
         EMPNO ENAME           JOB              MGR HIREDATE         SAL       COMM     DEPTNO
          7698 BLAKE           MANAGER         7839 01-MAY-81       2850                    30
          7499 ALLEN           SALESMAN        7698 20-FEB-81       1600        300         30
          7844 TURNER          SALESMAN        7698 08-SEP-81       1500          0         30
          7521 WARD            SALESMAN        7698 22-FEB-81       1250        500         30
          7654 MARTIN          SALESMAN        7698 28-SEP-81       1250       1400         30
          7900 JAMES           CLERK           7698 03-DEC-81        950                    30
    6 rows selected.From a book by Damir Bersinic:
    An easy shorthand enables you to remember the distinction between ANY and
    ALL. If a query condition is >ANY, each row in the result set is greater than the lowest value returned. When a query is >ALL, each row in the result set is greater than the highest value returned.
    He meant ; If a query condition is >ANY, each row in the result set is greater than the lowest value returned by the subquery. Didn't he?
    I couldn't find ANY and ALL operators in 10g SQL Reference? Are these operators being replaced by anything?
    Message was edited by:
    for_good_reason

    Look this
    >ANY------- means more than minimum
    Ex: sql> select empno,ename,job from emp
    where sal>ANY(select sal from emp job='CLERK');
    w/o using >ANY the query will be
    sql>select empno,ename,job from emp
    where sal>(select min(sal) from emp job='CLERK');
    >ALL-------- means more than the maximum
    Ex: sql> select empno,ename, job sal from emp
    where sal> ALL(select Avg(sal) from emp Group by deptno);
    w/o using >ALL the query will be
    sql> select empno,ename, job sal from emp
    where sal> (select max(Avg(sal)) from emp Group by deptno);
    sandeep

  • Differences between view and materialized view

    Hello,
    Please tell me the Differences between view and materialized view in oracle 9i.
    Thanks and regards
    Madhuri

    How can I create index in a view?
    Please read reply of Justin Sir.
    Regards
    Girish Sharma

  • Differences between OID and OUD

    Hello gurus,
    What are the differences between OID and OUD.
    Why Oracle release two LDAP directories. Please let me know.

    These two are two LDAP directories.
    Where OID is database dependent and OUD is not.

  • Differences Between Object And System Privileges

    Hi,
    Whats the difference between object and system privileges in oracle?
    Cheers
    Paul

    System Privileges
    A system privilege is the right to perform a particular action, or to perform an action on any schema objects of a particular type. For example, the privileges to create tablespaces and to delete the rows of any table in a database are system privileges.
    Schema Object Privileges
    A schema object privilege is a privilege or right to perform a particular action on a specific schema object:
    For example, the privilege to delete rows from the departments table is an object privilege.
    Some schema objects, such as clusters, indexes, triggers, and database links, do not have associated object privileges. Their use is controlled with system privileges. For example, to alter a cluster, a user must own the cluster or have the ALTER ANY CLUSTER system privilege.
    A schema object and its synonym are equivalent with respect to privileges. That is, the object privileges granted for a table, view, sequence, procedure, function, or package apply whether referencing the base object by name or using a synonym.
    Granting object privileges on a table, view, sequence, procedure, function, or package to a synonym for the object has the same effect as if no synonym were used. When a synonym is dropped, all grants for the underlying schema object remain in effect, even if the privileges were granted by specifying the dropped synonym.

  • Difference between in and exist?

    difference between in and exist?

    Note the name of this forum is "SQL Developer *(Not for general SQL/PLSQL questions)*", so only for issues with the SQL Developer tool. As AlexAnd suggested, please post these questions under the dedicated [SQL And PL/SQL|https://forums.oracle.com/forums/forum.jspa?forumID=75] forum.
    Regards,
    K.

  • Can Oracle be forced to use the spatial index for sdo_filter in combination with an or clause? Difference between Enterprise and SE?

    We’re seeing the following issue: sql - Can Oracle be forced to use the spatial index for sdo_filter in combination with an or clause? - Stack Overflow (posted by a colleague of mine) and are curious to know if this behaviour is due to a difference between standard and enterprise, or could we doing something else wrong in our DB config.?
    We have also reproduced the issue on the following stacks:
    Oracle SE One 11.2.0.3 (with Spatial enabled)
    Redhat Linux 2.6.32-358.6.2.el6.x86_64 #1 SMP Thu May 16 20:59:36 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
    11.2.0.3.0 Standard Edition and 11.2.0.4.0 Standard Edition (both with Spatial enabled)
    Microsoft Windows Server 2003R2 Standard x64 Edition
    However, the SQL works fine if we try it on Oracle 11.2.0.3.0 *Enterprise* Edition.
    Any help or advice would be much appreciated.
    Kindest Regards,
    Kevin

    In my experience sdo_filter ALWAYS uses the spatial index, so that's not the problem. Since you did not provide the explain plans, we can't say for sure but I think yhu is right: Standard Edition can't use the bitmap operations, and thus it'll take longer to combine the results of the two queries (because the optimizer will surely split this OR up in two parts, then combine them).
    BTW: when asking questions about queries here, it would be nice if you posted the queries here as well, so that we do not have to check another website in order to see what you are doing. Plus it will probably get you more answers, because not everyone can be bothered to click on that link. It would also have been nice if you had posted your own answer on the other post here as well, because my recommendation would have been to use union all - but since you already found that out for yourself my recommendation would have been a little late.

  • Difference between upgrdae and migration about oracle database

    Difference between upgrdae and migration about oracle database
    please give the comments

    Well, the question is almost philosophic...<br>
    In 9i, there is a Migration Guide whereas in 10g there is a Upgrade Guide.<br>
    Furthermore, in 9i, there is the command line startup migrate whereas in 10g that's startup upgrade.
    Somebody think upgrade when go to new release, and migration when go to new version.<br>
    Others think upgrade when new version replace database in place, and migration when new version include a move of database.<br>
    Another point of view is : upgrade is for technical, and migration for application/data.<br>
    <br>
    Well, after these explanations, your upgrade/migratation notion will not be more clear, but I think that is not very important, only a terminology game. The most important is to know what you need : new version or new release.<br>
    <br>
    Nicolas.

  • Difference Between 11i and R12 in Oracle HRMS only

    Dear All,
    Kindly Provide the differences between 11i and R12 version of HRMS.
    Example in 11i there is Retro by Element and in R12 we are using Enhanced Retro.
    Kindly share the Knowledge.
    Thanks & Regards,
    user13073875

    Srini_Chavali wrote:
    You will have to go thru the RCD documents to determine the delta differences.
    MOS Doc 1302189.1
    HTH
    Srini
    Isn't this doc already referenced many times in the link posted above by VigneswarBattu? -- https://forums.oracle.com/search.jspa?view=content&resultTypes=&dateRange=all&q=11i%20AND%20R12&rankBy=relevance&content…
    Thanks,
    Hussein

  • Differences between R12 and 11.5.9 in Oracle Learning Management Module

    Hi,
    I am into One Upgrade Project.
    I would like to know what are the differences between R12 and 11.5.9 in Oracle Learning Management and need to know any new Tables, Views, Forms and Reports got upgraded?.
    Thanks & Regards,
    Srinivasulu Vakati

    Hi Anders,
    Could you please explain me what is this SWAN Interface ?
    Kind Regards,
    Naga Suresh. Challapalli (Naga)

  • Difference between 'setup' and 'configuration' in Oracle Apps

    Hi,
    Thank in advance.
    I want to know Difference between 'setup' and 'configuration'(Oracle Apps ). Could you provide the details with an example, please?
    Regards,
    Raghavendra Rao

    Business Requirement:-
    ===============
    A company may want to allow all of its employees to make purchases up to $10 without having such purchases approved. Another company may have a business rule that each employee’s approval limit depends on his or her position within the organization.
    Question:-
    =======
    How to reach the above requirement?
    Is it thorugh configuration or setup?
    It must be through configuration and not set up.
    Set up is something like one time.. Configuration can be changed depends on your business needs.
    Like if your company wants to increases the limit from 10 to 100$, then change in configuration is needed.
    Hope you got the answer.. if you want more explanation, please be specific....

  • Difference between logical and virtual terms

    Hello,
    This is not purely oracle question; but in documentation so many times we find 2 terms:
    A. Logical
    B.Virtual.
    So what is the principle difference between logical and virtual? As I know physical is that which I can see and touch; while logical/virtual is that is imaginary. We say tablespace is logical not virtual; while Java Virtual Machine; not Java Logical Machine. So I want to know; what is the principle difference; why two words for an imaginary thing. Before posting question; I searched in google as “Difference between virtual and logical” but I couldn’t found the answer.
    Please quote your comments.
    Thanks & Kind Regards
    Girish Sharma

    Girish,
    I wont say that I am correcting you as this is like that half glass full/empty thing.May be what I see is half empty , you would see the same as half full.
    Well now coming to the explanation.I am saying honestly , I got more confused after reading your definitions.What do you mean by saing that tablespace is not virtual.I see it as purely virtual.We don't say it as virtual tablespace or logical tablespace but it is actualy logical/virtual, having no existance but just the definition right?
    How can you say that the size of virtual is larger than logcial?The size of tablespace is actualy the sum total of size of datafiles.So it actualy becomes very larger right?Much larger than JVM which is of few megs only.
    The point 3 totally knocked me out.I have no idea what you said.
    Ok I tell you this.Just remember the definition that Hans gave already.If you ask me than its the best definition that we can have. Just remember this and if some one asks you more further than give them your point 3 definition and tell them understand this ;-).Please don'tmind I am just kidding. Its just semantics.Don't get lost into it.You will find many people using both the terms interchangibly. So its ok.I shall stick with Hans's defintion,simple and concise.There are lot more other topics to dig upon in oracle.I can mail you lots of them.Spend time on those.Don't think that I am demotivating you.I understand you asked only because you have a doubt.But we got a good resolution of it and beyond that, its not of much use to dig it atleast not in the technial terms.
    Cheers
    Aman....
    PS:Are you on oraclecommunity.net?

Maybe you are looking for

  • Find multiple files from list

    Hello everyone, I have googled and searched this forum for a solution to my problem and have had no luck. What I need to do is find a list of files all at once. I'm a photographer and my situation is that I will do a photo shoot and have 5k images th

  • Re-downloading applications that I purchased on my iPod touch, to my iPhone

    OK the quick scenario is I purchsed 3 medical flash card applications that totaled over 100 bucks on my iPod touch. My iPod touch recently died, and was replaced by Apple, but my wife bought me an iPhone. I also do not have the computer anymore that

  • Adf Table with selection as set to NONE

    Hi, I having a scenario as explained below: I am populating records in to the adf Table After that I am using checkbox for selecting multiple records in the table and delete them. So I set selection property to None for the table. Because I want user

  • HELP Ideapad u310 touch win 7

    Hi everybody i got this ideapad U310 touch brand new and it came with win 8, then after i bought it i installed a win 7, it was working fine but the windows was asking for a valid prodcut key, i tryed a couple and no luck , so i found another win 7 f

  • Check my web pictures for me please

    Hi all Been having trouble loading pics on to my band website ( not iweb but going to buy ilife 08 soon ) I think I may have sorted it but just need someone to check it for me ( click on this link ) http://www.soul7.co.uk/headofsteam4.html and let me