473,325 Members | 2,792 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

to find top 10 salaries of employees with their names

HI, ItS URGENt PLZ ANSWER
Apr 30 '07 #1
2 2766
chandu031
78 Expert
Hi,

This is one of the most frequently asked and also most frequently answered question. Oracle has a built in function call rank() which has been introduced specifically to rank the records based an a criterion.So selecting the top 10 employees based on their salaries will look like this:

SELECT NAME,RANK ()OVER(ORDER BY SALARY DESC) RNK
FROM EMP
WHERE RNK < 11

However if there are two employees with the same salaries, the above query will assign the same rank to them (say 2) and skip the next rank(3) and assign rank 4 to the next employee. This means no continuity in ranking. If you want continuity then use DENSE_RANK() in place of RANK().
Apr 30 '07 #2
hi,

You can try this out....

select ename,sal from (select ename,sal from emp order by sal)where rownum<=10;

This will give u ur desired result.
May 1 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Melissa Kay Beeline | last post by:
OK, here's the sitch : we have an access control system at work that registers ever entry/exit of every employee. I recently made some queries in Access so the ppl in HR could make reports (who...
8
by: Richard Sherratt | last post by:
It's a database keeping info about people and is expected to contain 20,000 to 25,000 people. I could put a GoToPerson Combo on the form, but the customer and I are not to keen on that. It makes...
90
by: Bret Pehrson | last post by:
This message isn't spam or an advertisement or trolling. I'm considering farming some of my application development to offshore shops (I'm in the US). I have absolutely *no* experience w/ this,...
17
by: Justin Emlay | last post by:
I'm hopping someone can help me out on a payroll project I need to implement. To start we are dealing with payroll periods. So we are dealing with an exact 10 days (Monday - Friday, 2 weeks). ...
0
by: Kaur | last post by:
Hi, I am having problem trying to go to same record when I close 3rd form. I have a form called frmDepartment. This form has a list box that displays all the departments. Clicking on one of the...
8
by: Nicholas Reville | last post by:
Hi, I hope this is an OK spot for this question: I'm a co-founder of the Participatory Culture Foundation (pculture.org), we're a non-profit that develops Democracy Player and some related...
8
by: erick-flores | last post by:
Hello all My code used to work, but now its not working any more. What I am trying to do is find the current user when a forms open. This is the code that used to work: If...
4
by: rupinderbatra | last post by:
Hello Everyone, I have a table with the following structure: Employee ID, Salary. I want to find employees with top 5% salaries. Appreciate if someone may please help.
5
by: cart1443 | last post by:
So I know I need to add a few more lines somewhere to make this work, but I'm not sure how. // Lab 3: EmployeeTest.java // Application to test class Employee. /* Begin class declaration of...
5
zachster17
by: zachster17 | last post by:
Hi everyone, First of all, sorry for the massive amount of SQL I am about to type. I have a database that has a "lives" table of insured employees and then another table (that links to the lives...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.