What is the name of this query

Hi all

I want to know the name of this query to learn about it, because I don't understand how it works.

Select the columns tab "(select table columns)" table.

I saw him, but I don't know how it works.

Thanks in advance

It is a scalar subquery expression.

"An expression of scalar subquery is a subquery that returns exactly one column of a line."

The value of the scalar subquery expression is the value of the select item from the list of the subquery.

If the subquery returns 0 rows, then the value of the scalar subquery expression is NULL.

If the subquery returns more than one line, then Oracle returns an error. »

See:

http://docs.Oracle.com/CD/E16655_01/server.121/e17209/expressions013.htm#SQLRF52093

For example, we can write

Select empno,

Ename,

DEPTNO,

(select dname dept where deptno = emp.deptno) dname

WCP

order by empno

/

Instead of

Select e.empno,

e.Ename,

e.DEPTNO,

d.DNAME

from emp e,.

d Dep.

where e.deptno = d.deptno

order by empno

/

Tags: Database

Similar Questions

  • What is the name of this tool?

    Hello

    Could someone tell me what the name of this tool and what is the shortcut for this, please?

    Screen Shot 2016-05-10 at 10.33.00 AM.png

    He called the "Blob Brush Tool". The keyboard shortcut is SHIFT - B.  If you place your cursor on any tool you will see a tool tip with the name of the tool and in brackets the keyboard shortcut for the tool.

  • What is the name of this effect?

    What is the name of the effect of the vibrations of red-green in this video? Fall Out Boy - centuries (Hyperlapse edition) - YouTube

    How can I create it like this?

    Make two copies of your video. On the top layer add juggler channel. Use the background copy as the "second layer" then do something to the background layer to make slightly different images. Time shift or add a distorting effect. You get something like this:

  • What is the problem with this query in the source

    A blank page is region 2. Region1: enter rec_no (-rec_no is varchar2) region2:hide and show that displays one record based on rec_ no region1 entered.
    The problem is that I get the following error

    ORA-06550: line 1, column 7: PLS-00428: an INTO clause in this SELECT statement

    Here's my simple query in a process of pl/sql
    Start
    Select rec_no, rec_name from mytable where rec_no = upper(:P16_rec_no);
    end;

    Why? The same query works under the sql command.

    what I'm trying to accompolish here, it is because he has given huge if I want to display hide also multiples, regions and allow users to update each region as a result. Help, please. It kills me that I just can't understand what is causing the problem to the query. Thank you.

    Hello

    The list is set to the field EMPLOYEE_ID itself? What is the primary key of the table? In my example, DEPTNO is the primary key and I used the element generated by the wizard page to display the list. The parameters of the Source of the item itself or the column DEPTNO and database so that the process "process line...". "to identify the updated row.

    Andy

  • What is the problem with this query?

    Hello

    I need some advice on how to change the following query (with perhaps some analytical function) to speed it up. Currently, it takes 6 + minutes. This query is executed in response to a request from the front-end application and 6 + min is certainly unacceptable.

    I am trying to provide as much information I can think, but if more information is needed, please let me know.

    I have a table called "wave_result". It contains millions of rows. PK is Wave_Id, Version_nbr, node_nbr and prod_nbr. For each 'wave_id + node_NBR + prod_nbr' there are several versions (version_nbr). In the following query, I try to extract a line with MAX version_nbr for combination of ' wave_id + node_NBR + prod_nbr.

    H3. Request:
    SELECT ip1.fnln_cat,
                ip1.sub_cat,
                ip1.bus_cat,
                NVL (SUM (ip1.lsu), 0) val
        FROM ideal_prod ip1, ideal_store s, wave_result wr
       WHERE  wr.wave_id = 51
             AND wr.prod_nbr = ip1.prod_nbr
             AND wr.wave_id = ip1.wave_id
             AND wr.version_nbr =
                    (SELECT MAX (wr1.version_nbr)
                       FROM wave_result wr1
                      WHERE   wr1.wave_id = wr.wave_id
                            AND wr1.node_nbr = wr.node_nbr
                            AND wr1.prod_nbr = wr.prod_nbr)
             AND NVL (wr.ovrd_dcsn_nm, wr.dcsn_nm) = 'Add'
             AND s.wave_id = wr.wave_id
             AND s.node_nbr = wr.node_nbr 
    GROUP BY ip1.fnln_cat, ip1.sub_cat, ip1.bus_cat
    H3. Rank of charges:
    ========
    "wave_result" is the largest table with millions of rows.
    Table                Total Rows       Rows for wave_id = 51
    Ideal_prod           188K             38K
    Ideal_store          3K               574
    Wave_result          90M              19M
    H3. Stats
    are updated almost daily by the DBA (not sure if that's a good or bad).

    H3. Explain the Plan:
    =========
    SELECT STATEMENT ALL_ROWS Cost: 330,737 Bytes: 401,787 Cardinality: 14,881 
         12 HASH GROUP BY Cost: 330,737 Bytes: 401,787 Cardinality: 14,881 
              11 VIEW VIEW SYS.VM_NWVW_2 Cost: 330,737 Bytes: 401,787 Cardinality: 14,881 
                   10 FILTER 
                        9 HASH GROUP BY Cost: 330,737 Bytes: 2,425,603 Cardinality: 14,881 
                             8 HASH JOIN Cost: 327,183 Bytes: 41,233,784 Cardinality: 252,968 
                                  1 INDEX RANGE SCAN INDEX (UNIQUE) APAPOPR.XPKIDEAL_STORE Cost: 4 Bytes: 13,202 Cardinality: 574 
                                  7 HASH JOIN Cost: 327,178 Bytes: 35,415,520 Cardinality: 252,968 
                                       5 HASH JOIN Cost: 198,619 Bytes: 18,764,328 Cardinality: 183,964 
                                            3 TABLE ACCESS BY INDEX ROWID TABLE APAPOPR.IDEAL_PROD Cost: 939 Bytes: 2,272,380 Cardinality: 37,873 
                                            4 TABLE ACCESS FULL TABLE APAPOPR.WAVE_RESULT Cost: 197,063 Bytes: 7,974,414 Cardinality: 189,867 
                                       6 INDEX RANGE SCAN INDEX (UNIQUE) APAPOPR.XPKWAVE_RESULT Cost: 82,467 Bytes: 721,495,854 Cardinality: 18,986,733 
    H3. Sample data:
    ===========
       For wave_id = 51
                     there are 28466854 rows in "wave_result" table
    
       For wave_id = 51 and node_nbr = '0201' and  prod_nbr = '0226960'
                     there are 3 rows in "wave_result" table
    H3. Version of database information are below to:
    =========================
    Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
    PL/SQL Release 11.1.0.7.0 - Production
    CORE            11.1.0.7.0                        Production
    TNS for IBM/AIX RISC System/6000: Version 11.1.0.7.0 - Production
    NLSRTL Version 11.1.0.7.0 - Production
    Thank you very much!!

    Concerning
    For wave_id = 51
                     there are 28466854 rows in "wave_result" table
    
       For wave_id = 51 and node_nbr = '0201' and  prod_nbr = '0226960'
                     there are 3 rows in "wave_result" table
    

    As you mentioned that this particular request is called by a front screen, how different search criteria you get it to show on the front end?
    Assuming that if the user is searching just of wave_id = 51 which lines returns to 28466854, it is certainly not a good approach to go look up many records to put end Front end is very light and can not hold many records and will be finally the web server will throw off out of memory exception. Always a limit on the number of records that you retrieve from the database and display it on the front plane.
    OR
    The second case where the user makes a search by wave_id, node_nbr and prod_nbr, even if she returns to 3 lines, behind the scens, he still made a full scan on the wave_result table. If we go with analytical function, we can reduce a sweep of extra table on the wave_result table. Also the table has millions of lines and the max (version_nbr) seems to be a frequently used on this table sub query. While inserting a record into the table wave_result, you must probably have a calculated value that will tell you its value max and you will choose just the rank of this value, instead of at each time max(). something like below...

    SELECT ip1.fnln_cat,
                ip1.sub_cat,
                ip1.bus_cat,
                NVL (SUM (ip1.lsu), 0) val
        FROM ideal_prod ip1, ideal_store s, wave_result wr
       WHERE ipl.wave_id = 51
             AND wr.prod_nbr = ip1.prod_nbr
             AND wr.wave_id = ip1.wave_id
             AND wr.wave_id = s.wave_id
             AND wr.node_nbr = s.node_nbr
             AND wr.precomputed_max_value = 'MAX'
             AND NVL (wr.ovrd_dcsn_nm, wr.dcsn_nm) = 'Add'
    GROUP BY ip1.fnln_cat, ip1.sub_cat, ip1.bus_cat;
    
  • What is the name of this catalog? -for Mac OSX 10.6

    I have a laptop running OSX 10.4.11 and LR 2.3 shows the bar at the top of the active window with red, yellow and green dots on the left.  IN the Center is the name of the catalog that I opened.  Large.

    But on my machine main, a tower running OSX 10.6.1, LR 2.3 fills the screen with the active window, so the top edge is the black LR pane with the module on the right names.

    Two of them have the menu letter background white/black bart to the very, very high.

    Is it possible that I can have LR display the name of the catalog on both machines?  I try to get myself organized and know where I would be a very good thing.

    What happens if you press the F key a short time?  Looks like you are using full-screen.

  • What is the name of this effect and how to reproduce?

    Hi guys,.

    I just take the help of the community, looking for the name of cert effect and understand to reproduce.

    If you could take a look and help me.

    Thank you for all your help.

    Pat

    b02_3.jpg

    b02_4-u14157-fr.jpg

    It is without doubt filter > aesthetics > find the edges as well as Image > adjustments > invert.

  • What is the problem with this query? My head is numb!

    Can someone tell me why this request;

    < cfquery datasource = "manna_premier" name = "qGetstats" >
    SELECT the user name,
    UserFirstName,
    UserLastName,
    LastLogin,
    TotalLogins,
    UserZone,
    TM_Name
    USERS
    WHERE UserID = ' #. TM_log UserID # '.
    < / cfquery >

    generates this error message;

    Run database query error.

    [Macromedia] [SequeLink JDBC Driver] [ODBC Socket] [Microsoft] [ODBC Microsoft Access driver] Too few parameters. 1 expected.
    The error occurred in D:\Inetpub\mannapremier\TM_log_report2.cfm: line 28
    26 :         TM_Name
    27 : FROM Users
    28 : WHERE UserID = "#TM_log.UserID#"
    29 : </cfquery>
    30 : 
    

    SQLSTATE07002
    SQLSELECT the user ID, UserFirstName UserLastName, LastLogin, TotalLogins, UserZone, TM_Name FROM USERS WHERE UserID = '10120.
    VENDORERRORCODE-3010
    DATASOURCEmanna_premier

    I see that my variable WHERE comes through but the domain name is not working. I'm sure that the answer is obvious, but it drives me crazy!

    Help, please!

    I tried and got this result;

    No, you now use different data. Now, the user ID is empty, while she was 10120 first.

    The only problem seems to be double quotes. To check this, test with

    WHERE UserID = 10120
    

    I'm assuming that the userID field to be an integer. If it is text, then use single quotes (not!), as in

    WHERE UserID = '#TM_log.UserID#'
    
  • What is the name of this icon and how do I add it?

    Too bad I can't reach a very small screenshot of this icon; that would go a long way to help you identify for me. < hmm >?

    In any case, I have two different profiles that I use, and it has an icon on toolbar (applet-addon-thingy) that I find useful and would add to the other profile. The 'magical' applet appeared in the upgrade to FF30. Its function is almost a replacement for the old Menu bar, including such items as aid (absent in the icon menu Australis!). The first two elements of the applet are: 'New tab' and "New private window" There are two columns of menu items, the latter in column two a "Help".

    The appearance of the icon: a firefox - the grey Fox and a small triangle to the right indicating a "pull-down".

    I can't find this icon in my add-ons/plugins lists, so I think it's NOT an add-on, but rather native applet FF.

    My goal: Add this functional applet even to my other profile.

    Again, I could do this much easier if I could include an attachment of bitmap, but... I do not.

    Note that you can put the Firefox menu button in the tab bar to have shown that the earlier version of the Firefox App button menu and give a background color (orange).

  • What is the problem with this query? exception does not work.

    DECLARE
    v_employee_id EMPLOYEES. EMPLOYEE_ID % TYPE;
    v_last_name EMPLOYEES. LAST_NAME % TYPE;
    v_salary EMPLOYEES. % SALARY TYPE.
    e_invalid_emp EXCEPTION;
    BEGIN
    SELECT last_name, salary v_employee_id, v_last_name, v_salary, employe_id
    EMPLOYEES where employee_id = & employee_id;

    IF SQL % NOTFOUND THEN
    RAISE e_invalid_emp;
    END IF;

    DBMS_OUTPUT. Put_line(v_employee_id||) e '|| v_last_name | » '|| v_salary);

    EXCEPTION
    WHEN e_invalid_emp THEN
    DBMS_OUTPUT. Put_line ("' employee not found...");
    END;
    /
  • What is the name of the bar which is at the top of the screen?

    The bar which is at the top of the screen is gone. What is the name of this bar and how do I get that back?

    http://www.DellDock.com/

    If it is above > look in the start menu > programs > software Dell > Dell Dock > or re-download.

    If another brand computer > look in their software > under start > programs.

    See you soon.

    Mick Murphy - Microsoft partner

  • What can I do to prevent the failure of this query

    Someone used our search engine to submit the search term "NT the Australia".

    With the help of Barbara in several positions before this one, we have a thesaurus that transforms "NT" in "Northern Territory".

    If the "analysis function" I wrote eventually transform the search of this query string:
    select * from search_table where contains(keyfield,'(nt|northern territory) and (australia)')>0
    But which causes this error:

    -20000:ORA - 20000: Oracle Text error: DRG-10800: failed to query:

    I assume that the problem is "NT", which is taken to mean 'short term', rather than the State abbreviation. The same type of problem that can occur when someone searches for BT, which means 'British Telecom', but I imagine that this will be interpreted to mean "generic term".

    What is the usual way to stop these kinds of questions? I can write the code that replaces "NT" by "northern territory" before I even touched my dictionary of synonyms... but if I'm going to hardcode things like that, what else I'd be worried? And although I could replace 'BT' by 'british telecom', I imagine that anyone who wants to seek 'the confidence of bankers' could have a surprise if I.

    Is it all consistent, sensible, ways to deal with this kind of issue that does not imply that users think reading the spirit?

    "You say, I think, it was a stupid move and that there is no harm in putting each search term all about braces? "'({WOMAN}) and (HAT {})' would be just as acceptable, as fast as the '(femme et chapeau)? »

    Fix.

  • What is the meaning of this statement.

    Of http://docs.oracle.com/cd/E11882_01/server.112/e16638/optimops.htm#autoId34, there is not that I can't understand.
    If the path of the inner table is independent of the external table, then the same lines are retrieved for each iteration of the outer loop, significantly reduce the performance of the.
    What is the meaning of this statement? You can take an example for me?

    Thanks
    Lonion

    >
    Of http://docs.oracle.com/cd/E11882_01/server.112/e16638/optimops.htm#autoId34, there is not that I can't understand.

    If the inner table's access path is independent of the outer table, then the same rows are retrieved for every iteration of the outer loop, degrading performance considerably. 
    

    What is the meaning of this statement? You can take an example for me?
    >
    Can you say: join Cartesian?

    This quote is from the section explaining the nested loops. and note it gives you a clue:
    >
    See also:

    "Cartesian joins.
    >
    The sentence BEFORE the one you quoted, it is what connects your quote with the MENTION:
    >
    It is important to ensure that the internal table is driven out of the external table (function).
    >
    This statement means that the lines of the internal table should DEPEND ON the external table.

    In a Cartesian join the inner table will depend on the external table at all:

    SELECT D.*, E.* FROM DEPT D, EMP E
    

    There is no WHERE clause, so there is nothing saying Oracle tables are related as well. Oracle will perform a Cartesian join and if a nested loop is used then, as says your quote, "the same lines are retrieved for each iteration of the outer loop, performance degradation significantly."

    All Oracle ranks visits to query external table lines will now be the inner table. But because there is no WHERE clause is no available information to EXCLUDE lines from the internal table "the same lines are extracted" (ALL) "for each iteration of the outer loop.

    Here is the same query above using the USE_NL hint to force Oracle to use a nested loop

    SQL> select /*+ use_nl (d e) */ d.*, e.* from dept d, emp e;
    
    56 rows selected.
    
    Execution Plan
    ----------------------------------------------------------
    Plan hash value: 4192419542
    
    ---------------------------------------------------------------------------
    | Id  | Operation          | Name | Rows  | Bytes | Cost (%CPU)| Time     |
    ---------------------------------------------------------------------------
    |   0 | SELECT STATEMENT   |      |    56 |  3248 |    10   (0)| 00:00:01 |
    |   1 |  NESTED LOOPS      |      |    56 |  3248 |    10   (0)| 00:00:01 |
    |   2 |   TABLE ACCESS FULL| DEPT |     4 |    80 |     3   (0)| 00:00:01 |
    |   3 |   TABLE ACCESS FULL| EMP  |    14 |   532 |     2   (0)| 00:00:01 |
    ---------------------------------------------------------------------------
    
    Statistics
    ----------------------------------------------------------
              1  recursive calls
              0  db block gets
             42  consistent gets
              0  physical reads
              0  redo size
           3897  bytes sent via SQL*Net to client
            452  bytes received via SQL*Net from client
              5  SQL*Net roundtrips to/from client
              0  sorts (memory)
              0  sorts (disk)
             56  rows processed
    
    SQL>
    
  • What is the problem with this WHERE statement?

    What is the problem with this WHERE statement?

    < cfquery datasource = "manna_premier" name = "kit_report" >
    SELECT SaleDate,
    TerritoryManager,
    Distributor,
    DealerID,
    Variable,
    US_Dealers.ID,
    DealerName,
    DealerAddress,
    DealerCity,
    DealerState,
    DealerZIPCode
    Orders, US_Dealers
    WHERE US_Dealers.ID EQ DealerID AND SaleDate BETWEEN #CreateODBCDate (FORM. Implementation) # AND #CreateODBCDate (FORM. End) #.
    ORDER BY SaleDate
    < / cfquery >

    It's driving me crazy!

    Syntax error (missing operator) in query expression ' US_Dealers.ID EQ DealerID

    You accidentally use the CF equals operator: "EQ".

    Instead of MS Access: «=»

    [Macromedia] [SequeLink JDBC Driver] [ODBC Socket] [Microsoft] [ODBC Microsoft Access driver]...

    in a query expression. AND SaleDate BETWEEN #10/1/2009 #-October 18, 2009 #'.

    I don't see how CreateODBCDate() would produce these values.  But maybe it's just a quirk of the error message?

  • A40: What is the name of the memory?

    Hi I recently got a laptop sat pro a40.
    It shows 240 RAM and I want to add more memory to speed up the game of lineage 2. Question is what is the name of the memory, I need it please?
    love Kate xxx

    Hello

    You need a module of DDR memory like this:
    http://www.systemsassurance.co.UK/default.asp?shopID=systemsRelated.asp&PN=PA3313U-1M1G

    Good bye

Maybe you are looking for

  • Try to reformat the drive letter but Pavilion 5200 t is disabled

    I have a desktop Pavilion d5200t with an operating system upgraded to Windows 7 that must be reformatted.  I want to delete all data and start over.  When I put the Windows 7 CD in the drive and go through install, I click the link Options of readers

  • How can I uninstall vista defender?

    I install windows 7 and after the windows Advisor current execution, he recommended to uninstall my windows vista defender insalling before the upgrade. I can't uninstall defender somehow. Can anyone support me? Thank you

  • 5520x800CCC0F Server error

    Your server suddenly put an end to the connection. The possible causes for this include server problems, network problems, or a long period of inactivity. I cannt send and receive emails that I get this error message How can I fix this there is no wa

  • Pushing the screen

    Hello I am completely new to Java and Blackberry development and this may sound silly, but could someone help me with the starting code for pushing a screen? Please, I beg you!

  • Changes?

    Hello world I received an email that says that if my application is not approved, I can always submit again, but before the expiration of the offer. My application is still under consideration. Does this mean that if it is not approved, I'm not eligi