how to calcuate the second highest salary of he employee

Answers were Sorted based on User's Feedback



how to calcuate the second highest salary of he employee..

Answer / shailesh

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

Is This Answer Correct ?    0 Yes 1 No

how to calcuate the second highest salary of he employee..

Answer / jitendra

To get nth highest Salary, use below query

SELECT TOP 1 salary
FROM (
SELECT TOP nth salary
FROM Emp
ORDER BY salary DESC
) TmpTable
ORDER BY salary ASC

Replace nth with your number like second highest=2 4th=4 etc

Is This Answer Correct ?    0 Yes 3 No

how to calcuate the second highest salary of he employee..

Answer / vivek ghorad

select min(select top(2)salary from emp)from emp;

Is This Answer Correct ?    3 Yes 9 No

Post New Answer

More SQL PLSQL Interview Questions

Is sql a case sensitive language?

0 Answers  


what are local and global variables and their differences? : Sql dba

0 Answers  


how many triggers are allowed in mysql table? : Sql dba

0 Answers  


what is inline view?

15 Answers  


What is primary key and foreign key?

0 Answers  






What is sql basics?

0 Answers  


What is the difference between delete and truncate commands?

0 Answers  


what are the types of subquery? : Sql dba

0 Answers  


What is primary key sql?

0 Answers  


How do you sort in sql?

0 Answers  


What is the mutating table and constraining table?

0 Answers  


What is difference between a PROCEDURE & FUNCTION ?

6 Answers   Satyam,


Categories