473,404 Members | 2,195 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,404 software developers and data experts.

sql query need to retrive the 5th highest salary from a table

sir

i need a single sql query it may be sub query need to retrive the 5th highest salary from a employee table
Dec 19 '06 #1
2 9171
suvam
31
U can try this one ----->

select * from (select distinct val from suvam order by val)
where rownum < 6
Minus
select * from (select distinct val from suvam order by val)
where rownum < 5 ;
Dec 19 '06 #2
U can try this one ----->

select * from (select distinct val from suvam order by val)
where rownum < 6
Minus
select * from (select distinct val from suvam order by val)
where rownum < 5 ;
select * from emp e where 5=(select count(*) from emp where sal>e.sal)

thanks
srinivas
Jan 23 '07 #3

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

Similar topics

2
by: jared | last post by:
This is probably easy and I'm missing it because I'm a little sleep-deprived this month, but: given the following table 'test': name group salary ----- ----------- ...
4
by: sci | last post by:
Could someone help me by answering the questions below? What's a cursor? What's difference between Query and View? Is a RecordSet just part of a table? Can it be part of a query of view? If...
1
by: ComputerMan | last post by:
I am looking for a SQL command that allows me to list for example the top 2 or 3 values for each category. for example I have a table with names, town, salary. I want the names of the two people...
1
by: ajitsd | last post by:
I earlier posted this quetion to the Oracle group, but I am curious to find the solution to this problem in SQLserver. I want to find the second highest salary earner in each department in the...
0
by: Crimsonwingz | last post by:
I have a database that I wrote to show how much you will have in savings based on some given information: current balance current wage cost of living percent of salary to contribute per month...
14
by: Crimsonwingz | last post by:
Need to calculate a sum based on a number of factors over a period of years. I can use formula ^x for some of it, but need totals to carry over in the sum and have only been able to do this thus...
7
by: sunny | last post by:
Hi, I have the following data in my DB2 table ("Employee") : EMPID MONTH SALARY E340 JAN 3000 E340 FEB 2000 E340 ...
22
by: ranjitkumar | last post by:
Hi everybody, create table employee { empno char(5) primay key, name varchar2(30), salary number(5,2) }; 1. For the above table how to find the employee with the third highest...
1
by: sanjayvigil | last post by:
I have a table containing employid and salary. How can I find the employ with third highest salary.Please tell me
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.