How to get second highest salary from a table

Answers were Sorted based on User's Feedback



How to get second highest salary from a table..

Answer / senthil

select max(sal) from emp where sal <(select max(sal) from emp)

Is This Answer Correct ?    13 Yes 1 No

How to get second highest salary from a table..

Answer / srinivas

select * from emp m where(select count(distinct sal)+1 from emp s where s.sal>m.sal)=2

Is This Answer Correct ?    7 Yes 3 No

How to get second highest salary from a table..

Answer / saiz

select min(salary)
from emp
where salary in ( select top 2 salary
from emp
order by salary desc);

Is This Answer Correct ?    3 Yes 0 No

Post New Answer

More SQL PLSQL Interview Questions

What is the use of stored procedures?

0 Answers  


what is global table

7 Answers   iFlex,


Do triggers have restrictions on the usage of large datatypes, such as long and long raw?

0 Answers  


how to shutdown mysql server? : Sql dba

0 Answers  


Do view contain data?

6 Answers   Ramco,






How can I speed up sql query?

0 Answers  


7. Where would you look for errors from the database design?

1 Answers   Fintellix,


what are the differences between procedure-oriented languages and object-oriented languages? : Sql dba

0 Answers  


I need a function for a train ticket reservation please answer it thanks in advance

0 Answers  


What is nested table in pl sql?

0 Answers  


What is difference between procedure and trigger?

0 Answers  


Can a table contain multiple primary key’s?

0 Answers  


Categories