Details of employees with salary max theor Dept

Hi all

I'm trying to find some thedetails of all employees with the maximum salary in their Department.

I find using a few max (salary)
SELECT max (salary) FROM employee GROUP BY Dept.
But how to find the empno, ename, salary and other details?

Here are the data of employees
EMP NO  NAME       INIT  LASTNAME     DEPT  NO       HIRE DATE  JOB       LEVEL   SEX  BIRTH DATE   ARY     BONUS    COMM
000010  CHRISTINE  I     HAAS         A00   3978     1965-01-01 PRES      18      F    1933-08-24   52750   1000     4220
000020  MICHAEL    L     THOMPSON     B01   3476     1973-10-10 MANAGER   18      M    1948-02-02   41250   800      3300
000030  SALLY      A     KWAN         C01   4738     1975-04-05 MANAGER   20      F    1941-05-11   38250   800      3060
000050  JOHN       B     GEYER        E01   6789     1949-08-17 MANAGER   16      M    1925-09-15   40175   800      3214
000060  IRVING     F     STERN        D11   6423     1973-09-14 MANAGER   16      M    1945-07-07   32250   500      2580
000070  EVA        D     PULASKI      D21   7831     1980-09-30 MANAGER   16      F    1953-05-26   36170   700      2893
000090  EILEEN     W     HENDERSON    E11   5498     1970-08-15 MANAGER   16      F    1941-05-15   29750   600      2380
000100  THEODORE   Q     SPENSER      E21   0972     1980-06-19 MANAGER   14      M    1956-12-18   26150   500      2092
000110  VINCENZO   G     LUCCHESSI    A00   3490     1958-05-16 SALESREP  19      M    1929-11-05   46500   900      3720
000120  SEAN             O'CONNELL    A00   2167     1963-12-05 CLERK     14      M    1942-10-18   29250   600      2340
000130  DOLORES    M     QUINTANA     C01   4578     1971-07-28 ANALYST   16      F    1925-09-15   23800   500      1904
000140  HEATHER    A     NICHOLLS     C01   1793     1976-12-15 ANALYST   18      F    1946-01-19   28420   600      2274
000150  BRUCE            ADAMSON      D11   4510     1972-02-12 DESIGNER  16      M    1947-05-17   25280   500      2022
000160  ELIZABETH  R     PIANKA       D11   3782     1977-10-11 DESIGNER  17      F    1955-04-12   22250   400      1780
000170  MASATOSHI  J     YOSHIMURA    D11   2890     1978-09-15 DESIGNER  16      M    1951-01-05   24680   500      1974
000180  MARILYN    S     SCOUTTEN     D11   1682     1973-07-07 DESIGNER  17      F    1949-02-21   21340   500      1707
000190  JAMES      H     WALKER       D11   2986     1974-07-26 DESIGNER  16      M    1952-06-25   20450   400      1636
000200  DAVID            BROWN        D11   4501     1966-03-03 DESIGNER  16      M    1941-05-29   27740   600      2217
000210  WILLIAM    T     JONES        D11   0942     1979-04-11 DESIGNER  17      M    1953-02-23   18270   400      1462
000220  JENNIFER   K     LUTZ         D11   0672     1968-08-29 DESIGNER  18      F    1948-03-19   29840   600      2387
000230  JAMES      J     JEFFERSON    D21   2094     1966-11-21 CLERK     14      M    1935-05-30   22180   400      1774
000240  SALVATORE  M     MARINO       D21   3780     1979-12-05 CLERK     17      M    1954-03-31   28760   600      2301
000250  DANIEL     S     SMITH        D21   0961     1969-10-30 CLERK     15      M    1939-11-12   19180   400      1534
000260  SYBIL      P     JOHNSON      D21   8953     1975-09-11 CLERK     16      F    1936-10-05   17250   300      1380
000270  MARIA      L     PEREZ        D21   9001     1980-09-30 CLERK     15      F    1953-05-26   27380   500      2190
000280  ETHEL      R     SCHNEIDER    E11   8997     1967-03-24 OPERATOR  17      F    1936-03-28   26250   500      2100
000290  JOHN       R     PARKER       E11   4502     1980-05-30 OPERATOR  12      M    1946-07-09   15340   300      1227
000300  PHILIP     X     SMITH        E11   2095     1972-06-19 OPERATOR  14      M    1936-10-27   17750   400      1420
000310  MAUDE      F     SETRIGHT     E11   3332     1964-09-12 OPERATOR  12      F    1931-04-21   15900   300      1272
000320  RAMLAL     V     MEHTA        E21   9990     1965-07-07 FILEREP   16      M    1932-08-11   19950   400      1596
000330  WING             LEE          E21   2103     1976-02-23 FILEREP   14      M    1941-07-18   25370   500      2030
000340  JASON      R     GOUNOT       E21   5698     1947-05-05 FILEREP   16      M    1926-05-17   23840   500      1907
200010  DIAN       J     HEMMINGER    A00   3978     1965-01-01 SALESREP  18      F    1933-08-14   46500  1000      4220
200120  GREG             ORLANDO      A00   2167     1972-05-05 CLERK     14      M    1942-10-18   29250   600      2340
200140  KIM        N     NATZ         C01   1793     1976-12-15 ANALYST   18      F    1946-01-19   28420   600      2274
200170  KIYOSHI          YAMAMOTO     D11   2890     1978-09-15 DESIGNER  16      M    1951-01-05   24680   500      1974
200220  REBA       K     JOHN         D11   0672     1968-08-29 DESIGNER  18      F    1948-03-19   29840   600      2387
200240  ROBERT     M     MONTEVERDE   D21   3780     1979-12-05 CLERK     17      M    1954-03-31   28760   600      2301
200280  EILEEN     R     SCHWARTZ     E11   8997     1967-03-24 OPERATOR  17      F    1936-03-28   26250   500      2100
200310  MICHELLE   F     SPRINGER     E11   3332     1964-09-12 OPERATOR  12      F    1931-04-21   15900   300      1272
200330  HELENA           WONG         E21   2103     1976-02-23 FIELDREP  14      F    1941-07-18   25370   500      2030
200340  ROY        R     ALONZO       E21   5698     1947-05-05 FIELDREP  16      M    1926-05-17   23840   500      1907
I would like to find (empno, name, job, dept, sal) details of all employees earning a maximum wage in their Department.
I'm not sue if I have to use funcion analysis here.

THX
Rod.
select *
from
(
   select e.*,
          dense_rank() over (partition by dept_no order by salary desc) dr
   from   employees e
)
where dr = 1;

Tags: Database

Similar Questions

  • Details of the employees with their image

    Hello

    I have an Employee Table and each employee has an image. I use the type of region as the anonymous Pl/sql block. I want to view the details of employee with their Image. How can I do this?

    For work on what happens with P6_PRODUCT_IMAGE, we must continue to seek a single application - see also pages 6, there is an automatic line extraction process - it is vital for the mechanics of image display in the report.

    This help in your understanding peut

    https://forums.Oracle.com/message/3861537#3861537

  • Suppose I have a table emp that has thousands of lines of data. In this table, I have to get only the employees whose salary is equal.

    Hello world

    Suppose I have a table emp that has thousands of lines of data. In this table of employees receive wages between 1000-10000.

    Now I have to get only the employees whose salary is equal.

    for example

    empNo empName sal

    -----------     -------------      ---------

    1 ram 5000

    2 5000 Shyam

    3 1000 Dilip

    4 deepak 2000

    5 sisi 1000

    6 1000 Priya

    so now...

    Now without using ' select * from emp where Sal IN (5000,1000). "How can I get these employees with the same salary?

    SELECT *.

    EMP e1

    WHERE EXISTS (SELECT 99 FROM emp e2 WHERE e2.sal = e1.sal AND e2.empno! = e1.empno)

    or maybe

    SELECT *.

    WCP

    WHERE sal IN (SELECT sal FROM emp GROUP BY sal HAVING COUNT (*) > 1)

  • list employees whose salary greater than their salary of managers

    Hi all

    I have a requirement.i have two tables emp and dept tables in RPD. I want to get the report as employees whose salary greater than their salary of managers. The report contains empno, ename, salary.

    Please give me any suggesion

    Thanks and greetings

    K.Lavanya

    Are you able to see the table of discipline Manager?

    If Yes, try this

    Criteria - select sal EMP-> filter - > check the box to "convert this SQL filter '.

    Now, you will get

    "EMP". "" SAL "=.

    then add below statement

    "EMP". "' SAL ' > 'MANAGER '. "' SAL '


    Note:

    'MANAGER '. "' SAL ' denoted as wages of new table alias

  • You can access your email from HP employee with 7 slate?

    You can access your email from HP employee with 7 slate?

    Hello

    Yes, you can access your company email by setting up an Exchange account in the Mail application.  Check the COMPUTER help site for more information.

  • Tabular with nvl (max (col), 0) + 1

    Hi all

    I have a table block, I want to generate sequence for the key item numbers primary with nvl (max (col), 0) + 1

    I wrote this in a w-n-r-i trigger:

    "LAST_RECORD;

    SELECT NVL (MAX (ALERT_ID), 0) + 1 ON: EX_ALERT_SETUP. ALERT_ID EX_ALERT_SETUP; "

    but when I enter a new record with the cursor, it also gets the '1', body I have not saved the first '1 ',.

    How to deal with this situation?

    Thank you

    ORA-01400 wrote:

    Hi all

    I have a table block, I want to generate sequence for the key item numbers primary with nvl (max (col), 0) + 1

    I wrote this in a w-n-r-i trigger:

    "LAST_RECORD;

    SELECT NVL (MAX (ALERT_ID), 0) + 1 ON: EX_ALERT_SETUP. ALERT_ID EX_ALERT_SETUP; "

    but when I enter a new record with the cursor, it also gets the '1', body I have not saved the first '1 ',.

    How to deal with this situation?

    Thank you

    If it's a bad design, simply change the trigger as before Insert at the block level. Sequences of database is suggested.

    Hope this helps

    Hamid

  • Select the rows with values max.

    SELECT MOFFER.DELIVERYPURCHASE,
      MOFFER.OFFERSTART,
      MOFFER.OFFEREND,
      MOFFER.RANKING,
      MMTDEMANDBID.BALANCEGROUPPK
    FROM EMTMOFFER MOFFER
    INNER JOIN MMTDEMANDBID ON MOFFER.OFFERID = MMTDEMANDBID.MMTDEMANDBIDPK
    WHERE MOFFER.DELIVERYPURCHASE = 'P'
    AND MOFFER.OFFERSTART        >= '2012-01-18T00:00:00'
    AND MOFFER.OFFEREND          <= '2012-01-19T00:00:00'
    AND MMTDEMANDBID.BALANCEGROUPPK = '10393'
    DELIVERYPURCHASE OFFERSTART          OFFEREND            RANKING                BALANCEGROUPPK         
    ---------------- ------------------- ------------------- ---------------------- ---------------------- 
    *P                2012-01-18T23:00:00 2012-01-19T00:00:00 2                      10393*                  
    P                2012-01-18T23:00:00 2012-01-19T00:00:00 3                      10393                  
    P                2012-01-18T00:00:00 2012-01-18T01:00:00 2                      10393                  
    P                2012-01-18T01:00:00 2012-01-18T02:00:00 2                      10393           
    *P                2012-01-18T02:00:00 2012-01-18T03:00:00 1                      10393*         
    P                2012-01-18T02:00:00 2012-01-18T03:00:00 2                      10393                  
    P                2012-01-18T03:00:00 2012-01-18T04:00:00 2                      10393                  
    P                2012-01-18T04:00:00 2012-01-18T05:00:00 2                      10393                  
    *P                2012-01-18T05:00:00 2012-01-18T06:00:00 1                      10393*
    P                2012-01-18T05:00:00 2012-01-18T06:00:00 2                      10393                  
    P                2012-01-18T06:00:00 2012-01-18T07:00:00 2                      10393                  
    P                2012-01-18T07:00:00 2012-01-18T08:00:00 2                      10393                  
    P                2012-01-18T08:00:00 2012-01-18T09:00:00 2                      10393                  
    P                2012-01-18T09:00:00 2012-01-18T10:00:00 2                      10393                  
    P                2012-01-18T10:00:00 2012-01-18T11:00:00 2                      10393                  
    P                2012-01-18T11:00:00 2012-01-18T12:00:00 2                      10393                  
    P                2012-01-18T12:00:00 2012-01-18T13:00:00 1                      10393                  
    P                2012-01-18T13:00:00 2012-01-18T14:00:00 1                      10393                  
    P                2012-01-18T14:00:00 2012-01-18T15:00:00 1                      10393                  
    P                2012-01-18T15:00:00 2012-01-18T16:00:00 2                      10393                  
    P                2012-01-18T16:00:00 2012-01-18T17:00:00 2                      10393                  
    P                2012-01-18T17:00:00 2012-01-18T18:00:00 2                      10393                  
    P                2012-01-18T18:00:00 2012-01-18T19:00:00 2                      10393                  
    P                2012-01-18T19:00:00 2012-01-18T20:00:00 2                      10393                  
    P                2012-01-18T20:00:00 2012-01-18T21:00:00 2                      10393                  
    P                2012-01-18T21:00:00 2012-01-18T22:00:00 2                      10393                  
    P                2012-01-18T22:00:00 2012-01-18T23:00:00 2                      10393                  
     27 rows selected 
    Help, please. How to select lines with RANKING max, OFFERSTART and OFFEREND if the same.
    Get 24 ranks. One for every hour.

    SELECT MOFFER. DELIVERYPURCHASE,
    MOFFER. OFFERSTART,
    MOFFER. OFFEREND,
    Max (MOFFER. (Rank CLASSIFICATION),
    MMTDEMANDBID. BALANCEGROUPPK
    OF EMTMOFFER MOFFER
    INNER JOIN MMTDEMANDBID ON MOFFER. OFFERID = MMTDEMANDBID. MMTDEMANDBIDPK
    WHERE MOFFER. DELIVERYPURCHASE = 'P '.
    AND MOFFER. OFFERSTART > = ' 2012 - 01-18T 00: 00:00'
    AND MOFFER. OFFEREND<=>
    AND MMTDEMANDBID. BALANCEGROUPPK = '10393'
    Group of MMTDEMANDBID. BALANCEGROUPPK, deliverypurchase, offerstart, offerend

  • Sourcing rule works with min - max?

    Hello

    (1) Will Sourcing rule works with min - max planning? How?

    (2) and how you decide who use elements of planning elements u and wich Min - max, to the point of replenishment of development?

    Published by: 832641 on February 4, 2011 19:35

    (1) Yes, sourcing will work in the same way that it works with other sources such as kanban, etc. of the PSO. You must define the ASL for the rule point and sourcing with the corresponding transfer game.

    (2) according to my understanding logically point re - order is nothing but Min - Max, min, and max equal to Min value of the stock you want to maintain for the item

  • How to create two employees with the same name as the vendor record?

    Hi all

    We must create a vendor for the employee record, so that we can issue pretty invoice for cash payment. If there are 2 employees with the same name, how can we create records of supplier for these 2 employees? The system does not have the name of the provider in duplicate.

    Please notify.

    Kind regards
    HY

    Hello

    In R12, it is possible to create 2 employee with the same name but with a different number.
    And it is also possible to create these 2 employees as suppliers in Payables.

    HTH,
    Vik

  • support for files with extension .max-cannot open files

    I got a HP with Windows 98 computer.  When I got a newer computer, I downloaded the scanned files of visoiaire scanner on the new computer with windows XP.  Files are associated with the program file extension. MAX.  I'm unable to open files with windows XP.  I'm technically incompentent.  Y at - it a to change extension of files or open with Windows XP?  detailed instructions will be appreciated.

    That's what Filext.com about MAX:

    MAX file type is primarily associated with "PaperPort" of ScanSoft Inc. file: PPPAGEVW. EXE. Also captured by Visioneer Page view. If you have been sent a photo of a person in this format, try using the Viewer. If this does not work for you ask them to send the image in a format, you can display.

    This means that the Visionaire scanner connected to your old Win98 computer has been configured to save the files analyzed in this proprietary format.  The Viewer for this format - pppagevw.exe - no doubt has been installed on the Win98 computer, when the scanner was installed.

    Unfortunately, your new computer is that Viewer, you need to get here (go to the bottom of the page): http://support.visioneer.com/products/Tools/Utilities_2000_XP.asp

  • ISE 1.2: Employee with recording of flotation

    Hi experts,
    I am aware of this discussion https://supportforums.cisco.com/discussion/11962026/ise-12-device-regist...

    but looking for a detailed configuration to follow up on the work:
    The employee have access to the network with their departmental systems. No problem
    Employees must now be able to use their mobile devices to access. There is no definition of what devices are permitted.
    II think to let employees to register their devices with address private MAC in MyDevice portal would be the most sufficient solution.
    Any who have a detailed configuration or link how to do it?

    Thank you

    Frank

    Please see the link:

    http://www.Cisco.com/c/en/us/TD/docs/solutions/Enterprise/Borderless_Networks/Unified_Access/byoddg.html

  • Unexpected result with select max (colmn) in anonymous block

    Hello

    The following query gives me 28 800 like sum (sal)
    SELECT SUM(salary)
    FROM employees 
        WHERE department_id =60
    O/P is :  28800
    But when I use the above query in anonymous block, it gives me 684400
    DECLARE
     v_sum_sal NUMBER;
     department_id employees.department_id%TYPE := 60;
    BEGIN
        dbms_output.put_line ('The department_id is'||department_id);
       SELECT SUM(salary)
          into v_sum_sal 
        FROM employees 
        WHERE department_id = department_id ;
       dbms_output.put_line ('The sum of sal is'||v_sum_sal);
    END;
    Exit instructions above gives me 684400 as output... But the grounds are 28800

    You can me why the output differs block anonymous reference please

    Hello

    What about prefixing all your PL/SQL variables so that they do not match a column_name :

    DECLARE
     v_sum_sal NUMBER;
     v_department_id employees.department_id%TYPE := 60;
    BEGIN
        dbms_output.put_line ('The department_id is'||v_department_id);
       SELECT SUM(salary)
          into v_sum_sal
        FROM employees
        WHERE department_id = v_department_id ;
       dbms_output.put_line ('The sum of sal is'||v_sum_sal);
    END;
    

    Because, with the first names, where clause was equivalent to:

    where 1=1
    
  • Images are the scale is no longer with (img {max-width: 100% ;}) css from the 34.0.5 in firefox update, it still works fine in IE and chrome.})

    My site was working fine up until firefox updated 34.0.5. Now the images will not scale to fit the box more. I use flexbox so that the site is changing to adapt to the size of the browser. In css, I set img {max-width: 100% ;} and this would make the jpg file size automatically to fit the area they were in, but no more than Mozilla really screwed up this with updated 34.0.5.} My site still works fine with IE and Chrome, but 70% of my web traffic using firefox so I would really like this to work in firefox.
    Any help is greatly appreciated!

    I work by setting a special parameter in CSS for the images that I needed to scale and then I have it referenced by SPAN for each img in HTML, not quite how I wanted it to work since now images filling the box even with monitors really big format, which means that they could now be blurred on a 4 k monitor but firefox left me no choice. Looks like I have going to aid in future chrome like firefox really shit the bed on this 34.0.5 updated

  • Can query serial port with NI MAX, but does not work in Labview

    I'm controlling a 488 Sapphire consistent with labview. It is connected by a series of converter USB in the computer. I can communicate with a device using NI MAX, but when I try to run the vi (attached), he works for multiple queries, but evetually returns a null character, after which I can no longer communicate with the port. If I then go into the NI MAX interface, whenever I try to read it give "VISA: (Hex 0xBFFF0015) timeout expired before the operation ended" error message. There are also several queriess of the manual of the instrument which do not seem to work at all (with or without MAX) and always returns a null character. Any help is appreciated. I'm definitely a novice with the communication of the device. Thank you.

    Usually a problem with the stop character.

    And you send-r and no CarriageReturn.

  • problems with calibation MAX 4.5 talk to LabView 8.6.1

    Hello
    I use using Max 4.5 with an NI USB-6259 box. When I calibrate a scale with her, it checks good with to check the calibration.
    When I run LabView 8.6.1 power off. more load more its judgment. but this happens in only a tension, compression is fine.

    Hi, cotton,

    I'm curious, is there another load cell that you can try?  How do you save your configuration of MAX?  Are calibrate you for tension and compression?  Have you tried to use a panel of test at MAX to see if it's just your LabVIEW program giving you bad readings?  In addition, is the program that you run an example program, or that you wrote? Thank you for these answers!

Maybe you are looking for

  • Slate car charger 7

    Someone at - it does one know of a car usb charger which will be responsible for the 7 Slate. I'm 3 strikes & out. I got the dual usb charger base Amazon & then realized that it wasn't for tablets as it turned off only 1 ampere per port. Then I got t

  • No sound on Tecra S5, "THotkey" error starting Windows XP Home edition

    I have a laptop Tecra S5, I deleted some old programs for card readers.Now, sound does not work and starting the PC, windows starts and I get the message: "Error THotkey" this audio diviece is not supported. Is it just the audio driver what is missin

  • should I unplug iMac so that away from home for a period of time

    I'll be away from home for 6 weeks, we have power periodic interruptions where I is direct, he bet to unplug the iMac and airport Time Capsule at the moment that I'm missing?

  • Satellite L350 - stolen between the layers of the screen

    Hey I have a Satellite L350-16A, and I just noticed that there is a dead fly between the multiple layers of the screen. It's really very annoying.Is there anyway for dead fly out of here? I don't think that it is guaranteed, however, the guarantee sa

  • HP 15-r006Tu: admin password necessary Bios

    Request admin password BIOS SetupWith 3 attempts failed poster system 86769665 error