how to find the second highest salary from emp table?
Answer Posted / chitti
Hi Viewers here is the simple query to find the highest
salary:-
1)Highest five salaries:-
select top 5 salary from employee order by salary desc
2)Highest 5th salary:-
select top 1 salary from(select top 5 salary from
employee order by salary desc) temp1 order by salary asc
3)Highest 4th salary:-
select top 1 salary from (select top 4 salary from
employee order by salary desc) temp1 order by salary asc
4)Highest 3rd salary:-
select top 1 salary from (select top 3 salary from
employee order by salary desc) temp1 order by salary asc
5)Highest 2nd salary:-
select top 1 salary from(select top 2 salary from
employee order by salary desc) temp1 order by salary asc
6)Highest 1st salary or highest salary:-
select max(salary) from employee
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What do you mean by field in sql?
Is postgresql a server?
Is join and inner join the same?
What is the difference between delete, truncate and drop command?
Explain character-manipulation functions?
Explain the uses of database trigger.
Difference between truncate, delete and drop commands?
What do we need to check in database testing?
How many clustered indexes can you have?
How do I trace sql profiler?
How many clustered indexes can be created on a table?
What is dcl in sql?
How do I filter in sql profiler?
List and explain the different types of join clauses supported in ansi-standard sql?
what is data manipulation language? : Sql dba