find out the third highest salary?
Answers were Sorted based on User's Feedback
Answer / sanil
select first_name,salary from employees a
where (select count(distinct(salary)) from employees aa
where a.salary<=AA.SALARY) = &n;
| Is This Answer Correct ? | 0 Yes | 5 No |
Answer / anish nama
select Max(salery) from salery where salery IN( select
top N salery from salery order by salery asc)
| Is This Answer Correct ? | 1 Yes | 6 No |
Answer / hhh
select * from employee e where 3 = (select
count(distinct(salary)) from employee where e.salary <= salary);
| Is This Answer Correct ? | 0 Yes | 5 No |
Answer / brijesh
hi,
this query gives you the Nth highest salary, the trick is to
write (N-1) in the given place;
select salary from table as table1
where (n-1) =
(select count(salary) from table
where table1.salary<salary);
| Is This Answer Correct ? | 0 Yes | 6 No |
Answer / mamta
select rownum as maxsal,sal
from (select sal from emp order by sal desc)
where rownum <4
| Is This Answer Correct ? | 0 Yes | 6 No |
Answer / amit sutar
select min(salary)
from(select distinct(salary)
from employees
order by salary desc)
where rownum<=5;
| Is This Answer Correct ? | 1 Yes | 7 No |
Answer / alka
select min(salary)
from(select salary
from emp
order by salary desc
)
where rownum <=3
| Is This Answer Correct ? | 0 Yes | 8 No |
Answer / tejeswara rao potnuru
Find Out The Nth Highest Salary
SELECT MAX(SAL),LEVEL FROM EMP
WHERE LEVEL=&LEVELNO
CONNECT BY PRIOR SAL>SAL
GROUP BY LEVEL;
| Is This Answer Correct ? | 0 Yes | 8 No |
select empno,ename,sal from
(select empno,ename,sal from emp order by sal desc)
group by rownum,ename,sal having rownum=&n;
from this query we can find top nth sal
| Is This Answer Correct ? | 22 Yes | 38 No |
Answer / naveen kumar
Hi everybody,
This is one way to get the third highest salary
select ROWNUM as RANK from (select * from emp order by sal)
where ROWNUM<=3
| Is This Answer Correct ? | 11 Yes | 27 No |
How to find the date and time of last updated table?
What is index-organized table in Oracle?
What is schema?
41 Answers Bodhi Global Services, Cognizant, HCL,
What is the difference between view and materialized view in Oracle?
How to turn on or off recycle bin for the session?
how do u setup a replication site?
How to create id with auto_increment on oracle?
What is a Public Synonyms ?
What is a relational database management system?
How to drop a stored procedure in oracle?
What are the arithmetic operations?
How to build data dictionary view an new database?