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
Is it possible to create the following trigger: before or after update trigger for each row?
How does sql store data?
what does it mean to have quoted_identifier on? : Sql dba
What is autocommit sql?
What is trigger with example?
Explain the uses of control file.
Is null operator in sql?
How to get list of all tables from a database?
Can pl sql procedure have a return statement?
Table 1: col1 Timestamp ---------------- 01-mar-2012 11:12:46 Table 2: col2 Timestamp -------------------- 01-mar-2012 11:12:10 01-mar-2012 11:11:23 Write a query to display a row with table2 col2 value less than tabl1 col1 value. Maximum timestamp value previous to table1 col1 value. Display a result as: Col1 col2 ----- ----- 01-mar-2012 11:12:46 01-mar-2012 11:12:10
What is a table partition?
Is it possible to pass parameters to triggers?
What steps server process has to take to execute an update statement?
Why we use join in sql?
What is a dynamic query?