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
How many types of literals are available in pl sql?
How to load data with sql*loader?
What are the sql aggregate functions?
what is view? : Sql dba
how to create a new view in mysql? : Sql dba
what is a table in a database ? : Sql dba
What are operators available in sql?
Which is faster truncate or drop?
What is memory optimized table?
What are the types of records?
What is dml statement?
What is java sql drivermanager?
Why is nosql good?
What is the use of pl/sql table?
what is self join and what is the requirement of self join? : Sql dba