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 'mysqlimport'? : Sql dba

0 Answers  


What is pl sql record in oracle?

0 Answers  


What is benefit of creating memory optimized table?

0 Answers  


What are synonyms in sql?

0 Answers  


How do you write a subquery?

0 Answers  






Can we rollback after truncate?

0 Answers  


can i use global variables in stored procedure or function

1 Answers   L&T,


What is a schema in sql?

1 Answers  


How do you retrieve set of records from database server. {Set max records = 100 & use paging where pager page no or records = 10 & after displaying 100 records again connect to database retrieve next 100 }

2 Answers   DELL,


What is the difference between syntax error and runtime error?

0 Answers  


I have one table,in that table (1)i have java1.1 version books are 2 and java1.5 version books are 4. (2).Net2.0 books are 3, .Net3.5 books are 2 (3)ABC1.6 books are 4, ABC2.0 books are 3. Now i want output is like Book Count Java 6 .Net 5 ABC 7 For this i need sql query, please help me if anyone how to get this result. Thanks, Seenu

4 Answers   Adea,


What is delimiter sql?

0 Answers  


Categories