Can I use EXISTS?

Hi, I am fairly new to sql and need help with a query...
I have two tables
Titles
Name.............Number
A...................1
B...................2
C...................3
D...................4
etc
etc
Holders
Number.........Colour
1...................Blue
2...................Red
3...................Green
etc
I want to selct all from Titles where the number does not exist within holders.number. My simple query is
Select Titles.*
where Titles.Number = Holders.Number
and Titles.Number not in (select Number from Holders)
However, both table have > 50000 records and the query takes too long to run. How can I do this using NOT EXISTS?
Thanks,
Ian

Your two choices would look something like this...
Select Titles.*
from   Titles
where  Titles.Num_ber not in (select Num_ber
                              from   Holders
                              where  num_ber is not null);
Select Titles.*
from   Titles
where  NOT EXISTS (select 1
                   from   holders
                   where  holders.num_ber = titles.num_ber)
;Run some explain plans and benchmarks to see if one is faster than the other.

Similar Messages

  • Can we use EXISTS in where condition

    hi all,
    can we use EXISTS (instead of IN) in where condition of a query which is not part of a subquery ?
    for e.g:
    update gpf_vou_sm set up_amt=0 where src_cd exists ('1101','1201');
    the query works fine with the IN operator in place of EXISTS.
    anybody please help.
    thomas k prakash

    Hi:
    You can use EXISTS in where clause but not in that syntax.
    UPDATE gpf_vou_sm g
       SET up_amt = 0
    WHERE EXISTS (SELECT 1
                     FROM gpf_vou_sm
                    WHERE src_cd IN ('1101', '1201') AND id = g.id);Using IN in your case is better...
    Saad,

  • Can I use existing games in new Games Centre

    Just updated my 3gs to OS4.1 with no problems, my question is:-
    Can I use existing games already bought & paid for at the iStore in the new Games Centre? Iv'e tried dragging them in to no avail i'm begining to think in that money making fashion of Apple that you can only use newly purchased games.

    You mean in the money making fashion of Apple which doesn't make any money off the sale of paid apps with all free apps hosted and distributed by Apple at no charge to the developers with free apps? Apple keeps a percentage of the sales price for paid apps to cover associated expenses. The bulk of the revenue for paid apps is paid to the app developers with the developer for a paid app setting the price for their app.
    An app must be updated by the developer for the app to be included with the Game Center no different from an app needing to be updated by the developer for iOS4 to be suspended when leaving the app instead of being quit.

  • Can I use existing repository for master repository?

    can I use existing repository (for example repository from oracle designer )
    for master repository? could you give me please an explanation
    thanks

    You can use Existing repository for your master Repository.
    Or you can create a new schema in your database and create
    master repository on that schema.
    I hope this answers your question

  • (How) Can I use Existing Time Machine On New Mac Without Erasing Original TM Backups?

    I just got through doing a clean install from Mavericks to Yosemite and now I'm trying to attach and recognize the original Time Machine Drive (TMD)
    I chose to install as a new computer and did not choose a Time Machine backup option because the original TMD was not attached at the time of installation.
    Upon arriving at the desktop and connecting my original TMD, I was able to see it in finder but Time Machine did not automatically accept it.
    I am able to see the disk in Time Machine but it doesn't tell me that its got data on it .
    HERE'S THE ANXIOUS MOMENT:  If I select TMD, which is the original, will it overwrite all that orignal information, or will it continue adding to it?
    I've read under different parts of the forum that if you go through this process during the original setup and the Time Machine drive is attached to the computer then you will be prompted to inherit the old Time Machine. Since I didn't have the drive attached, I didn't see that.
    Now back to desktop and into the Time Machine utility:  This option to inherit doesn't seem to exist or is obvious.  The only option after selecting the drive in Time Machine  is "Use Disk".  If I click this, will it erase my original data or will it ask to inherit the drive?  It's not very clear what will happen after I click "Use Disk".
    Thanks so much to anyone who can help, Jeff

    Thanks for the link. I went there but didn't find any information on how to inherit the backup history.  The link says "If you’re replacing an old Mac and want the new Mac to use the backups from the old one, click Inherit Backup."  At what point in the migration process does it ask "to specify whether you (I) want a new Mac to inherit a backup"? It seems like I got quite a few levels into Migration assistant and the last click that I did not click seemed like it was good to start the process without telling me anything about inheriting anything.
    Any suggestions or did I not go far enough?
    From Apple Website below
    OS X Yosemite: If you want a new Mac to “inherit” your backup history
    You can move the backup history from one Mac to another, but after the new Mac “inherits” the backup history, you can’t use the backup history on the original Mac.
    You’re asked to specify whether you want a new Mac to inherit a backup if you do any of the following:
    Use Migration Assistant to transfer your settings from an old Mac to a new one.
    Use Migration Assistant to transfer your settings from a Time Machine backup of an old Mac to a new one.
    Clone the disk you use to start your Mac, or physically move it from an old Mac to a new Mac.
    Replace your computer’s main board.
    If you’re replacing an old Mac and want the new Mac to use the backups from the old one, click Inherit Backup.
    If you plan to continue to use your old Mac, click Create New Backup to preserve the backup history and start separate backups for the new Mac.
    Connect a new backup disk to your Mac 
    Transfer your info from a PC
    Last Modified: Nov 18, 2014

  • Can I use existing portal to connect to multiple R3 systems  for config

    I am planning to use existing portal 6.0 to connect to multiple R/3 systems for testing and configuration.
    We have three portals in our landscape DEV TST and PRD.
    Our R/3 system landscape -->DEV, DEV2, TST,TST2,TST3 etc.
    DEV portal is connect to dev system TST portal to R/3 TST system etc.
    Is there a way I can connect DEV portal to DEV2 R/3 System without effecting portal testing and configuration which is in progresses in DEV R/3 system.
    If any one has done it in the past, please share instructions
    Thanks,
    adil

    Hi Syed,
    Check this link for creating systems.
    Configuring EP for connecting to SAP R/3
    http://help.sap.com/bp_epv260/EP_EN/documentation/EP/N03_BB_InstallGuide_EN_US.doc
    Regards
    Arun

  • Can i use existing airport with Time Capsule

    i have already bought an airport, but can i use it with Time Capsule  OR do I need to buy the $299 Time Capsule wireless hard drive?

    If you are telling us that you have already bought an AirPort Extreme, and that you want to connect a USB hard drive to the AirPort and use that for Time Machine backups, this is not officially supported by Apple.
    Some users seem to be able to make this work, while others.....like me....who try this have nothing but problems.
    To be officially supported, you need to connect a hard drive directly to your Mac for Time Machine backups or use a Time Capsule.

  • How can I use existing anchor point as a new one?

    Can anyone help?
    I'm tracing over a drawing, and I'm trying to use an existing anchor point as an anchor point for another curve. So, from c, I want to click and drag on anchor point b to make a new curve. If I click where b is, then I just delete b. Can I make b my initial anchor point so that I can use it to complete my tooth? When I get to the next teeth Ill have to do the same thing. Has anyone any ideas?

    > Each tooth should be a closed path.
    Why?
    > If I click where b is, then I just delete b.
    Ugh, turn off Auto Add/Delete Anchor Point and watch your rage levels instantly decrease. You can then put your final point anywhere you want, including smack dab on top of B.

  • Can I use existing 10g iAS install with Application Express?

    I apologize if this has been addressed somewhere else, but I haven't been able to find a definitive answer yet.
    I have a 10g DB installed on machine A, and have been following the instructions to install Application Express. Instead of installing another instance of HTTP_Server (from the companion CD) on machine A, I have machine B with a full 10g iAS install on it (discoverer, portal, infrastructure, etc). I would like to use machine B as the front end to access htmldb. Machine B has 2 oracle homes, one for the infrastructure and one for the BI tools/portal stuff. Which one do I configure for htmldb? From reading in this forum I think I can use the dads.conf file instead of the marvel.conf file (which doesn't exist) to add the pls/htmldb info, but I can't figure out which one to edit. I probably have something else wrong somewhere, but this would help narrow things down. Currently when I go to the following url http://machineb:7778/pls/htmldb I get "503 Service Temporarily Unavailable".
    Thanks in advance for any help.
    Rhonda

    Sure, you can use the Application Server, no need to install another one.
    You would add the configuration to the BI tools/portal stuff Oracle Home, not the infrastructure.
    You don't need the marvel.conf explicitly (but this is installed per default when you install the http server from the 10g companion CD).
    You could just add the DAD configuration to the dads.conf.
    To make it a bit simpler I would do the following:
    1) remove the entries for /pls/htmldb from your current dads.conf (if they exist).
    2) follow the instructions here: http://www.oracle.com/technology/products/database/application_express/howtos/howto_useoas10g.html
    And use the following for the contents of the file marvel.conf (make sure to change it accordingly for your environment (changes to make are bold):
    AddType text/xml xbl
    AddType text/x-component htc
    Alias /i/ /home/oracle/oracle/product/10.2.0/db/htmldb/images/
    <Location /pls/htmldb>
        Order deny,allow
        PlsqlDocumentPath docs
        AllowOverride None
        PlsqlDocumentProcedure wwv_flow_file_manager.process_download
        PlsqlDatabaseConnectString localhost:1521:o1020
        PlsqlNLSLanguage AMERICAN_AMERICA.AL32UTF8
        PlsqlAuthenticationMode Basic
        SetHandler pls_handler
        PlsqlDocumentTablename wwv_flow_file_objects$
        PlsqlDatabaseUsername HTMLDB_PUBLIC_USER
        PlsqlDefaultPage htmldb
        PlsqlDatabasePassword <password for HTMLDB_PUBLIC_USER>
        Allow from all
        PlsqlErrorStyle ModplsqlStyle
    </Location>
    ~Dietmar.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • IPhone 3GS - Can I use existing US t-mobile SIM and German O2 SIM cards (for phone calls) without buying a data plan?

    I currently use 2 phones to make calls: one t-mobile locked phone for the US and one O2 locked phone for Germany, both without data plan.
    Can I upgrade using just one phone (factory unlocked iPhone 3GS)  and continue to use the existing SIM cards for phone calls (just switching the SIM cards when necessary), but use free WIFI spots worldwide for internet access/data transfer?
    Thanks Michael

    No supported carrier, including T-Mobile in the U.S., permits the use of an iPhone without a data plan. Though it's technically possible to do it, if and when they find you, they will either charge you for a data plan or shut down your account.

  • Can't use existing serial number on new laptop

    I had to purchase a new computer because my old laptop died.  When I installed my elements 8, a message indicated that the install was only good for 30 days because the serial number was already used on 2 computers and I therefore had to purchase a new seriel number.  One of the 2 computers was the one that crashed. Is there a way that I can use the existing serial number?

    You will need to contact adobe to get your activations straightened out. If you're in the US:
    Software activation
    866-772-3623

  • Can I use existing SSD in new 2013 macbook pro?

    Hi
    I have a 2009 macbook pro intel core 2 duo, and need more computing power to run Lightroom, as i'm a photographer.  I upgraded my RAM to 8gb, and bought a 500Gb SSD but my MBP still struggles with Lightroom.  I was thinking to upgrade to the latest i7 processor MBP, and switch the standard Hard drive with my SSD. 
    I already run Mountain lion, do you think there would be any compatibility issues with a straight swop?
    My SSD is still on warranty, so if so I could still return it get a refund on the heftty price I paid and get a retina screen MBP with an SSD already in it. 
    I have around 1,500 US dollars to budget on a new machine, I already have a second screen I run with my current model. 
    So, retina model and return the SSD or standard MBP and swop the HD if it works?
    Thanks!

    It's right there under Display.
    Most chose the Antiglare screen. But I'm not sure why.
    Click on the Store link, select Mac then Macbook Pro then scroll down for the 15" model and click the Select Button. Then scroll down until you see the Display section.

  • Need Help Can i use Merge command along with exist function in oracle?

    I am using Merge command to update the destination table and updating the rows which are already in the destination table.
    But what i want is to delete the existing rows from the destination table and insert fresh rows instead of updating the existing rows in the destination table.
    So can we use exist function to check the existing rows and delete them and use merge command to insert the rows in the table.

    You definitely need to do a DELETE then INSERT since MERGE will not delete rows, although I'm not really sure what that gets you since the net effect would be the same as a MERGE over the same pair of tables.
    If you really want to do it this way, then I would likely do something like:
    DELETE FROM target_table
    WHERE (columns_you_would_match_on) IN (SELECT columns_you_would_match_on
                                           FROM source_table
                                           WHERE predicate_you_would_use_in_using);
    INSERT INTO target_table (column_list)
    SELECT column_list
    FROM source_table
    WHERE predicate_you_would_use_in_using;John

  • 1. I have an iPod which has purchases synced with I tunes with an apple ID. I now have an iPad with a new ID for cloud. I have cloud storage capacity of 5gb which came with the iPad. How can I use one ID and store my existing music in cloud?

    1. I have an iPod which has purchases synced with I tunes with an apple ID. I now have an iPad with a new ID for cloud. I have cloud storage capacity of 5gb which came with the iPad. How can I use one ID and store my existing music in cloud?

    HI Frostyfrog
    CHeck out iTunes Match which has an annual fee of £21 or thereabouts. You can store a maximum of 25,000 songs there and they all become available on your other kit, iPhone, iPad and iPod. I know it works as I have over 23000 songs uploaded of which only a few we're bought through iTunes.
    it works by comparing your music to the whole iTunes music dadata base so you access the same tunes that you could get from iTunes. If you have obscure stuff, it uploads your own music to the cloud as a copy.
    I Find it incredible that on my iPhone with its 16gb memory I can view almost 200 gb of music (ie my 23000 songs) and play any of them. Anything I add to iTunes becomes available via the cloud fairly quickly from a few minutes or a little longer if adding a lot.
    The first time you use it it will take quite a while to match your music if you have a lot, but after that it is all automatic. Read the stuff on the apple site. Your PC needs to be at least running Vista. I recommend it and at less than 50p a week it's good value.
    Good luck

  • Can I use my existing E-mail address to retrieve my password reset through security questions

    Can I use my existing E-mail address to retrieve my password reset through security questions instead of through E-mail. When I try retrieving my new Apple password through reset through security questions?  On the Apple id, it will not allow me to do so becasue I forgot my security answers to the question. I'm naming one or two of the wrong vechiles which is what the questions ask me for for security questions.
    For icloud do you reccommend that I keep that same E-mail address or create a new one for my iCloud mail aside from my G-mail address name?
    I asked support community for the very first time to reset my security questions and it wanted me to create a new user name for iCloud when I already have *****l for my original Apple id.
    <Email Edited By Host>

    TheresaEW,
    I’d recommend contacting Apple directly to resolve your security question issue.

Maybe you are looking for