How to retrieve top 5 employees getting maximum salary

I have 100 employees, but I want to display only first 5 employee who are getting maximum salaries.

SQL> select empno,ename,sal from emp;
EMPNO ENAME            SAL
7369 SMITH         800,00
7499 ALLEN        1600,00
7521 WARD         1250,00
7566 JONES        2975,00
7654 MARTIN       1250,00
7698 BLAKE        2850,00
7782 CLARK        2450,00
7788 SCOTT        3000,00
7839 KING         5000,00
7844 TURNER       1500,00
7876 ADAMS        1100,00
7900 JAMES         950,00
7902 FORD         3000,00
7934 MILLER       1300,00
14 rows selected
SQL> select empno ,ename, sal from
  2  (
  3  select empno ,ename, sal from emp
  4    order by sal desc
  5  )
  6  where rownum<=5
  7  /
EMPNO ENAME            SAL
7839 KING         5000,00
7788 SCOTT        3000,00
7902 FORD         3000,00
7566 JONES        2975,00
7698 BLAKE        2850,00Regards,
Simon

Similar Messages

  • How to retrieve  "top sites" on imac

    How can you retrieve "top sites" icon on mac os x 10.5.8

    Thought captfred answered this
    https://discussions.apple.com/thread/3033745?tstart=0

  • How to retrieve 'top 5 timed events' from AWR

    Hello,
    I have a 10g database and awr is running every hour. How do I get the 'Top 5 Timed Events' from the awr report for every single hour on the last five days worth of awr reports? I can see the awr reports through GRID but where is the actual location of the snapshots? Instead of getting this information from awr reports, can I get 'Top 5 timed events' from the data dictionary for every hour for the last five days? Thank you in advance.

    watson2000 wrote:
    Hello,
    I have a 10g database and awr is running every hour. How do I get the 'Top 5 Timed Events' from the awr report for every single hour on the last five days worth of awr reports? I can see the awr reports through GRID but where is the actual location of the snapshots? Instead of getting this information from awr reports, can I get 'Top 5 timed events' from the data dictionary for every hour for the last five days? The "Top 5" comes from combining information about system events and the time model statistics. The information is stored in a number of tables in the SYS schema with names starting with WRH$, but also exposed in a set of views starting with DBA_HIST.
    To reconstruct the Top 5 hourly for the last five days, you will need to access DBA_HIST_SYSTEM_EVENTS (system events) DBA_HIST_SYS_TIME_MODEL (time model) and DBA_HIST_SNAPSHOT (list of snapshot ids and times).
    It won't be a trivial query, as you need to collect the "DB CPU" entry from dba_hist_system_time_model, union it with the dba_hist_system_events, then take the top 5 for each snapshot from the result. You'll probably need to look at subquery factoring and analytic functions to make this as efficient as possible.
    Regards
    Jonathan Lewis
    http://jonathanlewis.wordpress.com
    http://www.jlcomp.demon.co.uk
    "Science is more than a body of knowledge; it is a way of thinking"
    Carl Sagan
    To post code, statspack/AWR report, execution plans or trace files, start and end the section with the tag {noformat}{noformat} (lowercase, curly brackets, no spaces) so that the text appears in fixed format.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to stop the counter after getting maximum amplitude from a waveform graph?

    I am using accelerometer, optical encoder and daq card (PCI MIO 16XE10) for my tyre balancing project. Basically i am trying to stop my edges count from the optical encoder to get the position for putting the mass for correcting the balancing. Could anyone please help me by telling me how i can achieve it or is there any other ways to get the position using the daq card? One more thing, could anyone tell me how to change the waveform graph to frequency domain instead of time domain?

    Time to Freq is easy. 1/time = freq. example. 1 msec period = 1000 hertz (1kHz).
    I guessing you are attempting to design a new spin balancer for tires. I would record the entire "spin cycle with index count" then search the resulting waveform for the max amplitutes. Correlate the indexes and that should give you the high point and location. You might want to count the number of revolutions, then grab that 60% of that number of peaks.

  • How to retrieve the manager employee no

    Hi All,
                      I want to get the manager employee number of a particular employee. I have the employee no (PERNR) with me.I just want to know the manager of that pernr(employee).Is there any standard function module to find it out or any table where it will be stored.Plesae guide me.........
    Regards,
    Rakesh.

    Hi
    First use the RH_STRUC_GET Function Module by passting otype as P nad objid as Personnel number and wegid as B012,u will get the Manager's org details.
    Now call the RH_GET_LEADER fm to get the complete maneger details.
    Regards,
    Sreeram

  • Does anyong know how to retrieve bookmarks after firefox gets reinstalled I did hundreds of hours of study straight.

    I am hoping you can help me with this please reply. I spent hundreds of hours doing research for Collage. Mostly regarding IT courses, with between 5 and 40 hour research sessions every day, at least 10 weeks straight, but I cannot retrieve my bookmarks, Without going into detail. Windows, i.e. Microsoft, checked my primary hard drive without asking and changed its letter path, causing me to have problems booting the computer making it impossible to repair the operating system, which also effected the bookmarks in the old firefox browser. The collage I attend require in order to attend I use Firefox 3.6.28 or the lowest possible one available. Please help. I tried looking up bookmark help and even accessed the firefox profile folder but nothing has worked. Tanks in advance.

    See:
    *https://support.mozilla.org/kb/Recovering+important+data+from+an+old+profile
    *http://kb.mozillazine.org/Transferring_data_to_a_new_profile_-_Firefox
    You may still be able to access the old profile if you use the Profile Manager to create a new profile and choose the location of the old profile as the location for the newprofile.
    *http://kb.mozillazine.org/Profile_Manager

  • How to retrieve future hire records in HCM Extract?

    Please let me know how to retrieve future hire employee records from HCM Extract. Is there any DB item available for the same.

    HCM Extract related questions are likely better answered on the Human Capital Management (HCM) (MOSC) forum.
    Jani Rautiainen
    Fusion Applications Developer Relations
    https://blogs.oracle.com/fadevrel/

  • How to get top 10 employees in BEx Report

    Hi all,
    I am trying to get top 10 employees who have worked over 50 hrs of overtime in any pay period i choose in query.
    How do i get it ??
    right now my report gives me total of over 50hrs overtime in all chosen pay period employees list.
    Any suggestions ??
    Thank You,
    KSmith

    CAN  SOMEONE PLEASE HELP ME SOLVE THIS PROBLEM ??
    Hi all,
    The problem I have is even though i tried condition for top 10 employees who worked more than 50 hrs.
    My report right now shows all employees overtime under "OT" key figure for each pay period. --> I just want to show employees and overtime which is > 50 for each different pay period
    The condition works only if i display just one pay period...and user dont want it that way. they want to get more than one pay period displayed on the report and should have list of employees who work more than 50 hrs over time. HOW DO I GET THAT ??
    Also there is another key figure count meaning if out of those chosen pay periods there are 3 periods when an employee worked more than 50 hrs of over time then it should show "3". if there 2 pay periods when employee work more than 50 hrs count should display 2 ---> right now i am not able to get that also.
    Please can some one suggest something ??
    Thank You,
    KSmith
    Edited by: Keral Smith on Jul 25, 2008 2:49 PM
    Edited by: Keral Smith on Jul 25, 2008 3:08 PM

  • How to get second maximum salary from employee table(sql query)

    how to get second maximum salary from employee table(sql query)

    dude there is no matter of structure .........that user already said its from employee table ...............its basic table in sql and there is no need to specify the table structure
    .........i think u got my point I think you are the one who didn't understand Sarma's point.
    Give a man a fish and you feed him once. Teach a man how to fish and you feed him a life long.
    >
    and the query is
    select max(sal) from emp where sal<(select max(sal)
    from emp);
    this will give the 2nd max salary from the emp tableBtw: You solution is bad, because it needs to scan and sort the table emp twice. And a better solution has been given already.
    Message was edited by:
    Sven W. - reordered statements

  • How can we get the top 5 employees list ................

    How can we get the list of top 5 employees who are drawing highest salaries from a table

    SQL> select * from
      2  (select ename,sal from emp order by sal desc)
      3  where rownum < 6;
    ENAME             SAL
    KING             5000
    SCOTT            3000
    FORD             3000
    JONES            2975
    BLAKE            2850
    SQL>

  • ABAP HR- How to retrieve employees in past and future date

    I have a requirement in which i have to retrieve employees as mentioned below:
    User provides value for KEY DATE on selection screen ( I am using PNPCE selection screen).
    Now, i have to retrieve employees between date range (KEY DATE- 30 days ) and ( KEY DATE + 30 days) .
    example : user provides 31.10.2009 as KEY DATE on selection screen . Therefore, i have to process all employees within date range 01.10.2009 and 30.11.2009.
    I am using PNPCE logical database, Can anyone tell me how to achieve this by using GET PERAS event.
    Thanks in advance!
    Regards,
    Aleria

    PN-BEGDA and PN-ENDDA will initially be the same date, if this is a custom program then before you do the GET PERAS statement you can make PN-ENDDA = PN-BEGDA + 30.

  • How to find 'n' th maximum salary in employees table

    how to find 'n' th maximum salary in employees table using stored procedure............

    Depends on your unmentioned database version.
    In general you're asking for a Top-N query.
    See this article:
    http://www.oracle.com/technetwork/issue-archive/2007/07-jan/o17asktom-093877.html
    In 11g you have http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/functions114.htm#CJAFEJBE
    an analytic function
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17118/functions004.htm#SQLRF06174

  • My computer was stolen a few months ago i now have a new laptop with new id but don't know how to retrieve my itunes account for i forgot my old id. How can i get to my account?

    My computer was stolen several months ago and I now have a new laptop with a new id but I do not know how to retrieve my itunes account for i have forgotten my password and user id. I need a way to get into my old account.

    http://iforgot.apple.com
    Regards.

  • How to get Maximum Number of Concurrent users for last few days?

    Hi,
    How I can get maximum number of concurrent users which were logged in to the system (ECC 5.0) I mean I want to check the hostory for last few weeks. Is there any way to get the same? I know that I can get Cumulative number of users in st03 under Expert mode but that is the number of users logged into the system during the day. Is there any place where SAP maintians the High Watermark of Number of concurrent users reached in the system?
    Thanks in advance...
    Regards,
    Pravin

    Sorry I really missed that I have posted a question here on sdn. I wanted to know this for planning the system hardware requirements. Activities like PM ( Performance Management ) happens once a year and during that activity we see heavy user loan on the system so if I have the exact stats of 1 or 2 years data I can size the system better next time. Fortunately last 2 years PM was very smooth for us. In that look for the improvement because each time we had little extra Harware. By doing the exact analysis we can save a Cost of ownership...
    I was looking for R/3 users. I could see the number in st07 but I want to know the exact number at particular time.. I believe that st07 stores only for few days.
    Thanks
    Pravin

  • I plugged into iTunes and now all my notes on my phone are gone. Years worth of notes. Can someone tell me what to do to get them back?? I have iTunes set to back them up but can't find out how to retrieve them.

    I plugged into iTunes and now all my notes on my phone are gone. Years worth of notes that I stupidly don't have saved anywhere else. Can someone tell me what to do to get them back?? I have iTunes set to back them up but can't find out how to retrieve them.I plugged into iTunes and now all my notes on my phone are gone. Years worth of notes. Can someone tell me what to do to get them back?? I have iTunes set to back them up but can't find out how to retrieve them.

    After you restore from backup, you MUST sync to restore your iTunes content. No iTunes content is included in the iPhone backup. Your apps should be in your iTunes library, just sync them back to your phone. If for some reason your apps are not in your library, you can re-download them for free:
    http://support.apple.com/kb/ht2519

Maybe you are looking for