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 to download oracle sql developer?
How do I remove sql developer from windows 10?
What is cold data?
What is embedded sql what are its advantages?
Can a foreign key have a different name?
How do you respond to dementia behavior?
What is the difference between left outer join and left join?
What are the different set operators available in sql?
Is truncate ddl or dml?
Explain the uses of database trigger.
what are the t string functions available in tsql? : Transact sql
How do you rank data in sql?
What is lookup table in sql?
what is a table in a database ? : Sql dba
what is a view? : Sql dba