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

Write a sql to print only character form the below string. @So&*CIE%$TE@GEN!@RAL

1 Answers   Societe Generale,


I have one table and column is c1 pk, c2 not null,c3 not null and 200 row in it and i add c4 column and value, how can is possible

9 Answers  


How many parts of a pl sql block are optional?

0 Answers  


How do I run a sql query?

0 Answers  


How many postgresql users are there, worldwide?

0 Answers  






How would you hide a table in sql. ie the table can be only visible to its maker?

3 Answers  


What is sql integrity?

0 Answers  


What is difference between pls_integer and integer?

0 Answers  


What programs use sql?

0 Answers  


write a query to delete similar records in same table

13 Answers   TCS,


What does count (*) mean?

0 Answers  


Its possible to add more than one primary key for the table

4 Answers  


Categories