Finding id,max(salary) in oracle 10g

Select * from one:
ID SALARY
10 1000
20 2000
30 3200
Select * from two:
ID SALARY
10     1000
20     2000
40     4000
10     3000
20     4000
30     3000
When i try to find ID,MAX(SALARY) from these two tables, i am getting this output:
Select id,max(salary)
from
(select * from one
union
select * from two)
group by id
order by max(salary) desc;
OUTPUT:
ID MAX(SALARY)
20     4000
40     4000
30     3200
10     3000
I want OUTPUT to be like this:
ID MAX(SALARY)
20     4000
40     4000

Another way...
SQL> ed
Wrote file afiedt.buf
  1  with one as (select 10 as ID, 1000 as SALARY from dual union all
  2               select 20, 2000 from dual union all
  3               select 30, 3200 from dual
  4              )
  5      ,two as (select 10 as id, 1000 as salary from dual union all
  6               select 20, 2000 from dual union all
  7               select 40, 4000 from dual union all
  8               select 10, 3000 from dual union all
  9               select 20, 4000 from dual union all
10               select 30, 3000 from dual)
11  --
12  -- end of test data
13  --
14  select id, max(salary) from one group by id having max(salary) in (select max(salary) from (select salary from one union select salary from two))
15  union
16* select id, max(salary) from two group by id having max(salary) in (select max(salary) from (select salary from one union select salary from two))
SQL> /
        ID MAX(SALARY)
        20        4000
        40        4000

Similar Messages

  • Max connections in Oracle 10g Express

    Hi,
    How much connections are possible in Oracle 10g Express ?

    I do the following test:
    I format the test PC, install the O.S. and install Oracle 10g Express and run the following code:
    package testedb;
    import java.sql.Connection;
    import java.sql.DriverManager;
    import java.sql.SQLException;
    import java.util.ArrayList;
    import java.util.List;
    public class TesteDB {
         * @param args
         public static void main(String[] args) {
              List<Connection> connections = new ArrayList<Connection>();
              try
         Class.forName ("oracle.jdbc.driver.OracleDriver");
         while(true)
              connections.add(DriverManager.getConnection("jdbc:oracle:thin:@albatroz:1521:XE", "system", "xxx"));
              //connections.add(DriverManager.getConnection("jdbc:oracle:thin:@albatroz:1521:MYDB", "system", "xxx"));
              System.out.println("connections: "+connections.size());
         catch (ClassNotFoundException e)
         System.out.println ("Could not load the driver");
         e.printStackTrace ();
         } catch (SQLException e) {
              System.out.println("----------------------------------------------------------");
                   System.out.println("Qtd of connections: "+connections.size());
                   System.out.println("----------------------------------------------------------");
                   e.printStackTrace();
    After the first test I format again the PC, install the O.S. and install Oracle 10g Standard and run the same code, changing only the database name.
    Well, I get the following results:
    - Oracle 10g Express: I get 19 connections;
    - Oracle 10g Standard: I get 181 connection;
    Final report:
    With the same hardware (1GB RAM) and O.S. (Windows XP Professional) test, the Oracle 10g Express has any restrictions at the question max connections.
    Message was edited by: Hugo Haas
    Hugo Haas

  • Where can I find platform support metrix for Oracle 10g/11i JDBC drivers?

    I need find the official supported platform metrix of Oracle 10g/11i JDBC drivers.
    Where can I find this kind of information?
    especially, does Oracle 10g/11i JDBC drivers support Windows2008 and AIX6.1?
    Any information, please share with me here.
    Thank you so much!

    This Metalink has all the nesscessary inforamtion
    metalink 401934.1
    Besides this you can check the JDBC developers guide
    [For 11|http://download.oracle.com/docs/cd/B28359_01/java.111/b31224/overvw.htm#i1003779] [For 10g|http://download.oracle.com/docs/cd/B14117_01/java.101/b10979/overvw.htm#sthref61]

  • Max Connections to Oracle 10g RAC Instance

    Hi,
    We have IBM Websphere Application Server on one unix server which is connecting to a Oracle 10g RAC Instance which is on a different unix server through JDBC connection. They(Application Team) are doing stress tests, please tell me how many connections can a Oracle Database Allow simultaneously. They tested for 2000 connections simultaneously. It failed...This is urgent, they are on call please reply ASAP
    Thanks,

    Use Oracle Shared Server (the default is Dedicated Server),
    I've shown JBOSS app developers how a little Dell desktop (256MB RAM, 1.7Ghz P4) can accept a 1000 app server connections (using Shared Server). While a big HP-UX server failed to accept 200 connections (using Dedicated Server).
    Oracle RAC should easily be able to handle 100+ concurrent client OLTP connections per RAC node using Shared Server - assuming that each of the concurrent sessions are actually doing stuff and not just sitting there idle. (if 99.99% of the connections are idle, then even a little desktop Oracle database can handle well over a 1000)
    Bottomline - you must have your primary focus and expertise on Oracle. On the the data tier. Not the app tier. The data tier is what scales the app tier. Not vice versa. Adding an extra app tier server does not enable the data tier platform to suddenly be able to run more SQLs, The app tier does not scale the data tier.
    If you want performance and scalability, you must get the data tier right. App tier be damned as that is neither here nor there ito performance and scalability. This means Oracle expertise is required first and foremost.

  • OS authentication in Oracle 10g via jdbc:oracle:oci

    I'm very much a newbie to Java / JDBC and I am trying, but failing, to connect with the database using OS authentication via jdbc, and hoping someone may help.
    My questions are:
    1. Is OS authentication supported for jdbc:oracle:oci with Oracle 10g ? I couldn't find a general statement of whether it works or not.
    (NB.The only information I managed to find, on another forum, is that it should be supported but there is a bug and so it does not work, but the author did not post all of his/her platform details, so the bug may only affect his/her situation. )
    2. If it is supported and works, could some one suggest what is wrong with my syntax . I could not find an example in any Oracle 10g/JDBC documentation.
    The details are as follows: -
    Database : - Oracle 10g Enterprise Edition 10.2.0.2.0 running on Solaris.
    Development platform : - NetBeans 6.1, JDK 1.6.
    Runtime environment: - JRE1.6 on Windows XP professional.
    OPS$ authentication : - the OPS$ accounts have been set-up and we use these successfully for PL/SQL and SQL Plus access.
    JDBC : - I can connect to the database with both jdbc:oracle:thin ( linking in ojdbc14.jar) and jdbc:oracle:oci by using username and password, so I know my JDBC library linkage is OK, eg. this works fine :
    final String url = new String("jdbc:oracle:oci:" + uname + "/" + pword + "@" + environment);
    where environment is the SID
    I have trawled the Oracle documentation which tells me that OS authentication is not supported for Oracle 10g for the jdbc:oracle:thin driver, so I have tried to connect with jdbc:oracle:oci driver using the following code :
    final String url = new String("jdbc:oracle:oci:/@" + environment);
    final Driver driver = new oracle.jdbc.OracleDriver();
    DriverManager.registerDriver(driver);
    final Properties props = new Properties();
    conn = DriverManager.getConnection(url);
    but this gives the following error :
    java.sql.SQLException: ORA-01017: invalid username/password; logon denied
    Other info: - The tnsnames.ora file contains nothing but there are entries in the ldap.ora and sqlnet.ora files.
    My questions are:
    1. Is OS authentication supported for jdbc:oracle:oci with Oracle 10g ? I couldn't find a general statement of whether it works or not.
    (NB.The only information I managed to find, on another forum, is that it should be supported but there is a bug and so it does not work, but the author did not post all of his/her platform details, so the bug may only affect his/her situation. )
    2. If it is supported and works, could some one suggest what is wrong with my syntax . I could not find an example in any Oracle 10g/JDBC documentation.

    If you specify the SID/service_name in the url, you are attempting to connect via SQL*NET and REMOTE_OS_AUTHENT must be set to true in the database. If you are connecting from the same host the database runs on, then just leave the SID off and make sure the ORACLE_SID environment variable is set.
    You can reproduce the same error you get in java with
    sqlplus /@SID
    SQL*Plus: Release 10.2.0.2.0 - Production on Fri Nov 7 12:14:08 2008
    Copyright (c) 1982, 2005, Oracle.  All Rights Reserved.
    ERROR:
    ORA-01017: invalid username/password; logon deniedSample Code:
    import oracle.jdbc.pool.OracleDataSource;
    import java.sql.Connection;
    import java.sql.SQLException;
    public class conn {
      public static void main(String[] args) throws SQLException {
        OracleDataSource ods = new OracleDataSource();
        ods.setURL("jdbc:oracle:oci:/@");
        Connection conn = ods.getConnection();
        conn.close();
    }

  • Oracle 10G on Win XP

    I would like to know where can I find the instruction to install Oracle 10G on a Win XP machine. I have the following disk:
    1. - Oracle DB 10G Rel 3 (10.1.0.2) Windows 32 Bits
    2. - Oracle 10G Client
    And I would like to know if I need to install both disks. I'm developments that also do DBD roles.
    Thanks!

    I think you might find that in the "Quick Installation Guide for Microsoft Windows" at
    http://www.oracle.com/pls/db102/portal.portal_db?selected=1 (for 10gR2) or
    http://otn.oracle.com/pls/db10g/portal.portal_demo3?selected=1 (for 10gR1)
    <g>

  • Oracle 10g express editon for windows 7  x64

    I cant find a free download for oracle 10g express editon or oracle 10g personal editon for windows 7 x64. Any Help?

    Could you use the express edition of 11g instead? I don't believe any edition of 10g was supported on Windows 7.
    Justin

  • Oracle 10g file missing

    Hello,
    I am unable to find the ocrs12.zip in Oracle 10g. Is it replace by another name in 10g ? becuase in 8i/9i still have

    Are you willing to install different version on the same machine ? If yes, then it is strongley recommended that you must use different oracle homes.
    hare krishna
    Alok

  • Nagios plugins for oracle 10g...

    Hi there,
    I'm on a quest for nagios plugins for oracle 10g.
    Here is what I've found so far:
    mathias-kettner.com/download/check_oracle_writeaccess -- good
    nagios-plugins-1.4/contrib/check_ora_table_space.pl -- useless for 10g
    nagios-plugins-1.4/plugins-scripts/check_oracle.sh -- useless for 10g
    nagios-plugins-1.4/contrib/check_oracle_tbs -- good
    nagios-plugins-1.4/contrib/check_oracle_instance.pl -- not sure yet
    Where might I find more nagios plugins for oracle 10g (or 9i would be good too)?
    Once I find them,
    I'll be nice and post my findings here!
    Thanks,
    -R

    Hi Eric,
    I want to know whether Oracle 10g Standard Edition supports any extensibilty mechanism to do kerberos authentication using third party plugin or adapter.
    Actually I want to implement/want support for some kerberos authentication adapter/plugins for oracle 10g SE.
    Advanced Security Option of oracle comes only with Oracle Enterprise edition not with oracle 10g SE.
    Thanks,
    Sayantani

  • Oracle 10g OLAP CWM2/AW

    Are CWM2 packages obsolute in Oracle 10g? I could not find documentation of CWM2 in Oracle 10g docs. It has only AW.

    Sorry. I ,eamt obsolete. CWM2 Packages are built-in packages to support Common Warehouse Model. For example, create_cube etc. And AW is Analytic Workspace. I like to know that whether in latest Oracle 10g version with OLAP options, CWM2 packages are available or not.

  • Oracle 10g on VMWare

    I have not been able to find a satisfactory answer regarding Oracle 10g on VMWare. On one page, Oracle states that "Oracle will not support production deployments of Oracle software on VMware" (http://www.oracle.com/technology/tech/linux/vmware/cookbook/index.html). However, the Metalink article it references states "Oracle will provide support of the Oracle Stack on VMware. If a problem is investigated where Oracle software gives a problem specifically when running on a VMware virtual machine, and it can be reproduced on a physical PC, a bug will be submitted to development for resolution. Any issues which are VMware
    specific will be referred back to VMware for support."
    Now I'm stuck in a difficult position: I have a production database installed on a VMware device that is seriously sucking wind (mostly related to disk I/O and swap, either the VMware device or the ESX server it's running on) and I have contradictory information from Oracle. Does anyone have any insight into a formal position from Oracle?
    Without a definitive answer, I need to figure out a way to tune what I have to squeeze every last drop of performance from the VMware device. I am running Oracle 10gR2 in 9.2.0.6 compatibility mode. I am running RedHat Enterprise Linux 3 ES, update 7. The VMware device has 2 CPUs and 2 GB of RAM (the most this version of ESX can provide is ~3.5 GB but I start running into issues because the ESX server is oversubscribed at that amount of RAM). The database is doing mostly OLTP and is approximately 150 GB in size.
    Any assistance / guidance is greatly appreciated.

    I
    start running into issues because the ESX server is
    oversubscribed at that amount of RAM). The database
    is doing mostly OLTP and is approximately 150 GB in
    size.Do you think being oversubscribed on the memory might be a factor to why you are seeing high I/O and swapping?
    What they stating is that Oracle will support the product in VMWare providing the problem can be reproduced on a physical machine. Oracle is not alone in this regard, many other companies are taking the same position.

  • Oracle 10g Management Console - Client software

    Hi,
    Could someone point me in the right direction? I just got a new PC at work and our desktop folk can't find the download for the Oracle 10g client. We run ORacle 10g EE on our Unix servers, and I have alwaya had the 10g Management Console on my PC but now I've lost it and I can't seem to find the correct install to download on the Oracle website. I've searched but I can't find it.
    Can anyone point me in the right direction please?
    Thanks,
    Paula

    10gR2 client software can be downloaded from here - http://www.oracle.com/technetwork/database/enterprise-edition/downloads/index.html (scroll down)
    I am not sure if they include the management console software.
    HTH
    Srini

  • Will Oracle 10g and Oracle XE happily co-exist on same machine?

    I can't seem to find anything specifically saying that Oracle 10g and Oracle XE can be installed on the same Windows machine. The only reason I'd want to do this is that I originally had the free version on my Windows machine. The uninstaller nevers seems to run a complete job and always leaves bits over. So I'd like to install Oracle 10g alongside Oracle XE.
    Wondered if anybody had done this already?

    to uninstall Oracle, do the following:
    1. Uninstall all Oracle components using the Oracle Universal Installer (OUI).
    2. Run regedit.exe and delete the HKEY_LOCAL_MACHINE/SOFTWARE/ORACLE key. This contains registry entires for all Oracle products.
    Delete any references to Oracle services left behind in the following part of the registry:
    HKEY_LOCAL_MACHINE/SYSTEM/CurrentControlSet/Services/Ora*
    It should be pretty obvious which ones relate to Oracle.
    4. Reboot your machine.
    5. Delete the "C:\Oracle" directory, or whatever directory is your ORACLE_BASE.
    6. Delete the "C:\Program Files\Oracle" directory.
    7. Empty the contents of your "c:\temp" directory.
    8. Empty your recycle bin.
    At this point your machine will be as clean of Oracle components as it can be.
    Remember, manually editing your registry can be very destructive and force an OS reinstall so only do it as a last resort.

  • Unable to find Oracle 10g 32 bit

    Hi All,
    I am planning to download Oracle 10g 32 bit version, but i couldn't find any where in 10g 32 bit version.
    can anyone please help me to get 10g 32 bit version please.
    Thanks
    Lav
    Edited by: Lavanya on Nov 29, 2012 1:07 PM

    Hi;
    I am planning to download Oracle 10g 32 bit versionthis version is not avaliable anymore for public download. So
    1. Rise Sr for setup
    2. Contact wiht oracle local office for setup
    PS:Please dont forget to change thread status to answered if it possible when u belive your thread has been answered, it pretend to lose time of other forums user while they are searching open question which is not answered,thanks for understanding
    Regard
    Helios

  • Unable to find Oracle 10g 32 bit software

    Hi All,
    I am planning to download Oracle 10g 32 bit version, but i couldn't find any where in 10g 32 bit version.
    can anyone please help me to get 10g 32 bit version please.
    Thanks
    Lav

    Posting duplicates is considered as abuse of the forums - Unable to find Oracle 10g 32 bit

Maybe you are looking for