question of the scope of variables

Hi guys,.

Select book_key
books
where exists (select book_key from the sale)

If we have the above query, it means that the book_key in sales is independent of the book_key in the books? As far as I see it, all what we are doing is saying that if a book_key exists in the table sales, then we want to return the books book_key. In other words, the book_key of books doesn't have to exist in sales.

It seems completely different from

Select book_key
books
where book_key in (select book_key from the sale)

because in this case, we want to only return the books book_key, if it exists also in sales.

Am I wrong?

Thank you

OracleGuy777 wrote:
Hi guys,.

Select book_key
books
where exists (select book_key from the sale)

If we have the above query, it means that the book_key in sales is independent of the book_key in the books? As far as I see it, all what we are doing is saying that if a book_key exists in the table sales, then we want to return the books book_key. In other words, the book_key of books doesn't have to exist in sales.

You're right, except that it is saying "If * a * line exists in the sales table": book_key may be NULL for each line in the sale, and the main query will always return each book_key books.

EXISTS subqueries are almost always correllated to the main request.
The following Gets the same results as the query you posted using IN:

SELECT  book_key
FROM    books  m   -- m for main
WHERE   EXISTS ( SELECT  NULL   -- The column "selected" makes absolutely no difference
                 FROM    sales
                 WHERE   book_key = m.book_key
               );

Tags: Database

Similar Questions

  • question about the scope of variables and memory

    I searched the Adobe documentation for an overview, but apparently, I'm not in the right place.

    Here is an example of simplified code:

    < AS >

    loadedImages:Array = new Array();

    function createImageData(imageNumber:Number):void
    {
    var imageData:BitmapData = new BitmapData (width, height);

    Switch (imageNumber)
    {
    case 1:
    imageData.draw (loader1.content);
    loadedImages [imageNumber] = imageData;
    break;

    case 2:
    imageData.draw (loader2.content);
    loadedImages [imageNumber] = imageData;
    break;
    }
    }

    < virtue >

    ImageData defined inside the function createImageData(), I know that I can not access any outside level of the function block.  But what about memory?  ImageData still exist once the code has "left" the createImageData() function?

    For example, if the function above is called twice (once with imageNumber = 1, once with imageNumber = 2), what I remember?

    -BitmapData objects stored in loadedImages [1] and loadedImages [2] and 1 BitmapData object named imageData

    -BitmapData objects stored in loadedImages [1] and loadedImages [2] and 2 BitmapData named imageData objects

    -BitmapData objects stored in loadedImages [1] and loadedImages [2] and nothing else

    Is there a way to see the 'elements' in memory, not just the quantity?

    If you call twice createImageData, for imageNumber = 1 and imageNumber = 2, there will be only 2 persistent objects to the Bitmap in memory, and they will be made by the loadedImages table. The imageData variable is just the first to receive the pointer to the allocated memory and past him on the elements of the array until it's life is over. Only when you delete the table, you will release the objects for the GC.

  • Question on the scope, theoretical

    Hello

    I have a question on the scope. It's something that I'm probably not on Java and OBJECT oriented programming.

    I am writing a program, that can handle several documents (images) of simple image processing. Now I have a DialogNewGUI with an actionPerformed method. In this method, I test for the appropriate action command and if NEW is the action command that I should create a new document (for example, a Document class). What worries me is that if I create an instance of a Document class in the scope of the actionPerformed method, we only see in this method, right? So, how do I access these Document instances newly created throughout the entire application? I think, I need a kind of global variable holding a reference to the Document instance, so I can work on it from anywhere in the code, but I don't think that there is such a thing in Java as global variables. I thought that, maybe, I need to create a class, called Basic, to contain the references in the world, but I don't know if I'm not running in the same issue there either.

    Someone has an idea? Thank you

    PR

    It is not clear what exactly you're trying to do. If you want to keep track of documents (images) which currently manages your image processing system, you will need to add in some kind of a collection - Let's say a card openDocuments, which in turn is handled by another class - let's call it imageProcessingSystem. You should then be able to add and to remove documents from the collection and to keep track of documents course of treatment.

  • The strangeness of the scope of variables?

    I'm having a problem with a script component, and I think it might be a bug.  I reproduced the problem with this simplified version:

    If {(true)
    int Packers = 1;
    {
    Packers = 5;
    patExecContext.setProcessDataIntValue ("/ process_data/@nTest", Packers);
    }
    }

    I think that my variable Packers of process should be out in the 5, but I get 1. The same problem occurs with ropes.

    Can someone reproduce cela and let me know if I'm losing my mind here?  Thank you.

    Jared

    Hi Jared,

    I can reproduce the behavior so that your mind is ok.

    The custom Script is a BeanShell implementation and on the top of my head I don't know what version of BeanShell is. Apparently the scope has changed in BeanShell (see http://www.beanshell.org/manual/syntax.html).

    This works...

    Boolean test = true;

    Packers int;

    If {(test)

    Packers = 1;

    {

    Packers = 5;

    patExecContext.setProcessDataIntValue ("/ process_data/@nTest", Packers);

    }

    }

    Steve

  • question on the scope of the stage object

    Hello, all.  I am currently working with containers and I have a question about the stage object.

    I have 2 files in my program

    (1) app.as

    (2) stuff.as

    Stuff.As is a library of common user interface that I build.  I'm trying, in this document, follow these steps:

    stuff(){
    
    makeUI();
    
    }
    
    makeUI(){
    
    myContainer.setSize(stage.Stagewidth , stage.Stagehight);
    
    }
    

    Flash crash when running, saying that there is a reference not valid for a null object.

    If main.as is the file of the application, how can I get the stage object to be valid / available inside my stuff.as file?

    -Thanks for your time!

    Hey dtater,

    I met the same problem too in the past. the only way to have access to the stage is to have the class that never work added to the stage by a parent object that is already on scene. If an object has not yet been added to the stage, his stage value will be null.

    the best way to work with this set of return must have an event listener defined in your file stuff.as to listen for Event.ADDED event in your stuff() constructor like this:

    this.addEventListener(Event.ADDED, onAdded);
    

    and then in your event handler function onAdded:

    private function onAdded(e:Event):void{     // this event gets triggered by other objects, so we check to make sure it the right object     if (e.target == e.currentTarget)      {          makeUI();
    
         }
    
    }
    

    in this way the makeUI funciton only will be called when it has access to the scene.

    Here are more details on the event Event.ADDED:

    http://www.Adobe.com/LiveDocs/Flash/9.0/ActionScriptLangRefV3/Flash/events/event.HTML#added

    hope that helps. Good luck!

    Edit: I also forgot to add that the Event.ADDED event will be called when you addChild (stuff); in your main application.

  • Problem of the scope of variables

    I'm having trouble understanding variable scope in the following situation. See dynamically, go to my site and click on Librio. Then click on the first book of the left (the years-down).

    The code reads an XML file that includes a summary of the book, and also the comments it received. For each review, a circle appears. These buttons are created dynamically. I'm moving the XML node that is appropriate to the function onRelease, but nothing helped. Any idea? (The code below has commented)

    Thank you for answer and locate me the area that failed. Your solution was not well resolve the issue. The variable 'i' was long forgotten. Given that I named the buttons with a number at the end, this is recover the index I want. Knowing that the beginning of the name is still the same and there will be no more than 9 clients as possible, it is easy to retrieve information about an order of substr. The number is located on the index '9' and is a length of characters:

  • Question about the scope of the object and memory.

    I created a class that extends Sprite.

    In this class, I have a private type BitmapData var

    I then add the Sprite as a child to another Sprite on the stage.

    Later, I delete the second Sprite (parent) of the scene and I put the variable referring to it to null.

    After the garbage collection (assuming that it happen correctly) there is no trace of the BitmapData?

    No, unless you did something extra.  If you cannot reference your bitmapdata object (and has no listener), he is eligible for gc.

  • Question on the scope and the framework / time line

    Hello!

    I write a little app and have the buttons and sliders on a field 1 of the scene and then a help screen on frame 2 of the scene.

    I have event listeners attached to the objects of the first image.  When I go to the second image and then return to the first image, all event listeners are passed away and no longer work.  (at least that is what I think is happening).

    My question is what is the best way to deal with this.  I think the best way would be to add something like adding Event listeners. ADDED_TO_STAGE for each object and have the listener function add event listeners I want for each item.

    So I will:

    public function Document()

    {

    Super ();

    iSlider.addEventListener (Event.ADDED_TO_STAGE, added);

    iSlider.removeEventListener (Event.REMOVED_FROM_STAGE, withdrawn);

    myButton.addEventListener (Event.ADDED_TO_STAGE, buttonAdded);

    myButton.addEventListener (Event.REMOVED_FROM_STAGE, buttonRemoved);

    }

    In each of the listeners, I would add / remove listeners that respond effectively to the key / slider.

    Is the best way to do it, or I missed something.  Sorry about the silent nature of this question, but I'm gay.  I hope someone less gay can help out me.

    -Thank you

    you are probably missing when you move to the structure 2.  It is a problem when using as3.

    an appeal is to remove your objects in the scene (using code - NOT the timeline) in box 2.  (re) you can add them to the stage in frame 1.

  • Legacy, causing loss of the scope of variables?

    Hi all

    I am working on a class right now, "Block" that has several private variables (call)
    _Color,
    _x,
    FLF,
    _parent...

    I have a second class (BlockGenerator range block). In the constructor for BlockGenerator, I call the block using super (parent, x, y) and then I put some of the reactive power inherited from the block class. I'm trying to compile in strict mode, but it is causing the following error message:

    1119: access of the property possibly _color not defined through a reference with static type src.game:BlockGenerator.

    the error is reported on the following line in the BlockGenerator constructor:
    This ._color = new BlockColor (BlockColor.PLACE_HOLDER);

    I've attached some more sample code. Please let me know if anyone has an insight as to why my class BlockGenerator cannot see inside vars inherited from the Block class.

    Thank you
    Nomadic design

    Sometimes you get so wrapped up in the complexity of what you are doing that ignore you completely what is obvious.

    Thank you
    Nomadic design

  • Problems with the scope of variables or reference (AS2)

    Hello!

    The code simple below maps onRelease functions to 8 buttons.
    The goal is to load the image into a single central imagePanel whenever a button is clicked.

    There are 8 instances of the same MC on the stage (called g0 to g7), each containing a button (btnShow)

    The function 'downloadImage()' load the image when the onRelease event is triggered.
    Each image file path is taken from the _global.paintings Array (the url property).

    The problem:
    It looks like this, during the transfer, a link for the "removal" of the 'I' variable, instead of its VALUE.
    So, at runtime, the 'I' is equal to 8 (value at the end of the loop for EACH function of downloadImage), instead of the value incremented (0 to 7)...

    Leading to each button of the same image, rather than the corresponding image loading (end of the url in _global.paintings property [0] to [7])

    Well, not easy to explain properly, I hope you understand what I mean...

    Thank you very much for your help, I am quite lost here!
    See you soon
    Luca


    =======

    Try this:

    function formatGal() {}

    for (var i: Number = 0; i<8; i++)="">
    . _root ["g" + i] btnShow.myIndex = i;
    _root ["g" + i].btnShow.onRelease = function() {}
    downloadImage (_global.paintings [this.myIndex] .url);
    trace (this.myIndex);
    }
    }
    }

    --
    Dave-
    Developer leader
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.Adobe.com/communities/experts/

  • scope of variables?

    I'm looking for any discussion on the scope of variables in Captivate. I searched these forums and the help site but have not come up with something useful.

    According to the information I have encountered so far, it seems that Captivate has no local variables, which means that no matter what variable I declare will be global in this project.

    Is this correct?

    Thank you

    Pete

    Indeed, object names must be unique.

  • Features and scope of variables

    I use this code:

    var getdata:LoadVars = new LoadVars();

    GetData.Load ("datatoflash.php");
    getdata.onLoad = function() {}
    var graphData:Array = new Array (this.rating1, this.rating2, this.rating3, this.rating4, this.rating5);
    };
    trace (graphData)

    I understand the scope of variables. But I want to check something, I learned. When the trace is made, there the Guthrie listed as indefinite. This is because it has been declared within the function. Is it all still get the function table and use them on the other where, in my film? Even if the Board is filled inside the function?

    The track is called before the onLoad never happen as it takes time for a file to load. If you did not ensure that the data is loaded to a party outside the onLoad, so this isn't a good idea to use it. In order to demonstrate that he is working, have:

    Stop();
    var getdata:LoadVars = new LoadVars();
    getdata.onLoad = function() {}
    graphData = new Array (this.rating1, this.rating2, this.rating3, this.rating4, this.rating5);
    nextFrame();
    }

    And on the next framework: trace (graphData);

  • Scope of variables: Application.cfm vs Application.cfc - very confusing

    Hi all

    ColdFusion newbie here, please bear with me :)

    I am currently responsible for the upgrade of a huge project of ColdFusion 5 (more than 1,000 pages of CF) for ColdFusion 8, I tried to refactor old code in CFCS, but ran into a problem with the scope of variables, or lack thereof.

    In the old application, there is a single Application.cfm in which a bunch of global variables are defined, without scope, as:
    < CFSCRIPT >
    ...
    PrimaryDataSource = 'TestDB '.
    ...
    < / CFSCRIPT >

    It seems that variables defined as this can be viewed very well in all CFM pages using #PrimaryDataSource #, but not in one of my new pages of CFCS.

    What should I do for that these variables global scopeless available for CFCS? Also, what actually means if global variables are defined without any scope?

    I'm really new to ColdFusion, so I would be very grateful if someone could throw a light here!
    Thanks in advance.

    Billy

    n3p3nth3 wrote:
    > Hi all,
    >
    > ColdFusion newbie here, please bear with me :)
    >
    > I am currently responsible for the upgrade of a huge project of ColdFusion 5 (more than 1000 CF
    (> pages) for ColdFusion 8, I tried to refactor old code in CFCS, but
    > ran into a problem with the scope of variables, or lack thereof.
    >
    > There an Application.cfm in the old application, where a bunch of global
    > variables are defined, without scope, such as:
    >
    > ...
    > PrimaryDataSource = "TestDB".
    > ...
    >

    >
    > It seems that variables defined as this is accessible very well in all the CFM
    > pages using #PrimaryDataSource #, but not in one of my new CFC pages.
    >
    > What should I do for that these variables global scopeless available in the
    > SWC? In addition, which actually means if global variables are set
    > without any scope?
    >
    > I'm really new to ColdFusion, so I would be very grateful if someone could throw a
    > turn on here!
    > Thanks in advance.
    >
    > Billy
    >

    They are not global variables. Local variables in the variables
    scope. On one of your current pages, PrimaryDataSource would be the same
    as variables. PrimaryDataSource.

    How it works currently, is that Application.cfm is an automatic
    included file. That is, for every single request, this file is
    automatically included at the beginning of the request and all these
    local variables are defined and exist only for the duration of this request.

    When you start to refactor the code in the CFC, you'll have to
    get a better handle on how to deal with these types of broad application
    variables. There are a few choices.

    One, you can create them as truly global variables is in the
    application or session brought rather than local and temporary variables
    scope. You use depends on whether the value of a variable is the
    even for all users [app] or may be unique to each user [session].

    Second, you can set these variables within CFC itself as one
    variable local "variables" scope inside the CFC. These variables will be
    live as long as an instance of the CFC lives. So if the CFC
    has persisted in session or application scope, then the data of "variables".
    inside she will persist.

    It is a great subject and a response email will not cover
    all the ins and outs of it. You are looking at a huge task and will want to
    to do a lot of reading. I suggest starting with the ColdFusion
    documentation. It has good chapters that cover all these details
    about the various scopes of variables and other chapters which cover
    Components. After ColdFusion documentation, there are now three
    volume "ColdFusion Web Application Construction Kit" by Ben Forta et al.
    Finally, there is a vast internet blogs, discussion lists and
    Tutorials that cover all these topics in lower and more details.

  • How to insert as an entry within the formula variable, the total time on the scope window?

    How to insert, as an entry within the formula variable, the window of total time on the scope (i.e. of 20ms/div x 10 div = 200ms)?

    HERE'S A SAMPLE QUESTION:

    FORMULA FOR INTEGRAL ACTION:

    STATISTICS:

    Input variable: DPO4034 (CH1);

    Box: number of samples.

    FORMULA

    Input variable 0: DPO4034 (CH1); alias: x 0

    Input variable 1: 'time window Total out of scope?. " alias: x 1

    Input variable 2: number of samples (CH1); alias: x 2

    Under the operation Configuration: formula

    Y = (x 0 ^ 2) *(x1/x2)

    Output: Data 1 (CH1)

    THEN, WITH THE HELP OF STATISTICS:

    Input signal: data processing 1 (CH1)

    Checkbox: SUM

    Output: CH1 integral Action [has ^ 2s].


  • Question &amp; VI credentials of the scope again

    Just trying to keep quickly my powershell...

    So I created a .ps1 include file that I load in my PS profile by making a point scoring. .\VIinclude.ps1 ... Some of the functions I want to put here are common things as VC connect and disconnect-VC, also define some global variables. For example, these functions to connect to VC using a file of credentials of cookie in read-only format for the statement of the functions of type. The issue I noticed is, when I call these functions of PS by simply entering the function, authentication works and holds for this session. But when I run other scripts in the session that call these functions in the include file, the credential is not retained.  (for example a script dump-vms-in - cluster.ps1 calling definied connect-VC in the include file, does not work, but if I run VC plug then dump-vms... all works)

    What are the rules for the determination of the scope for this kind of thing?

    Question - is there a way to prevent the automatic connection using the currently logged-on user is connect-viserver ?  IN many cases, I want to force PS scripts to always ask authentication, because my rule of thumb is to run scripts with as little as possible privilege on VC/Resource Pools etc to do the job.

    Happy to be told if go and RTps.1FM but I am a prime, second VCP PS guru-wannabe.

    Thanks Peeps, happy vSphereing

    /Kimono/

    I suspect that the Connect-ViServer is called from a function in the include file?

    Then the framing rules begin to play, see also to connect-viserver to remain persistent through different functions..

    This thread also contains a pointer to course of PowerShell of Tobias (strongly advised to have a look).

    You can force a prompt for a username/password by practice

    Connect-ViServer -Server  -Credential (Get-Credential)
    

Maybe you are looking for

  • Problem of design/exercise book

    Hello world I'm new to Labview. I just started with the student Labview 2011 edition and I'm following the Bishop's book. But I also want a book of tutorial with a lot of problems of design and exercises to get my skills. I am a postdoc at the purdue

  • How can I transfer more 64-bit data to the target host?

    Hi all, I currently use fpga PCIe-7851r card to drive my camera. There were 64 lines to remotely control. So what I did generates the commands on the host pc and transfer it to the target via DMA FIFO. The data type of the FIFO is U64, i.e. each digi

  • Both cartridges C6380 does not print

    Photosmart C6380.  OEM cartridges.  Tried to print a photo, but it came out pink and black.  Said software all color cartridges are low (I don't think this) so I replaced all the cartridges color four with new HP cartridges.  Always print this rose.

  • How to print a QString on the console with qDebug()?

    Hello I print out the string of newspapers on the console with the method qDebug ("planned method of working"); and it works very well. but when I use qDebug (contact.firstName ());  It displays error (no matching function for call to qDebug (QString

  • Install XP on a Compaq CQ70-211EM

    Hi all Not being satisfied with Vista, I decided to install XP on my notebook CQ70-211EM. Lack of a USB floppy drive, it seems that I must "wake" my version of XP with SATA driver concerned for this computer. However, I am struggling to find this dri