how to find the second highest salary from emp table?
Answer Posted / hitesh pundir
elect max(salary) from m1 where salary not in (select top
n-1 salary from m1 order by salary desc)
-->note where n=number as we want
to display the highest salary.
ex for 2nd highest salary-->
select max(salary) from m1 where salary not in (select top 1
salary from m1 order by salary desc)
ex for 3rd highest salary-->
select max(salary) from m1 where salary not in (select top 2
salary from m1 order by salary desc)
| Is This Answer Correct ? | 4 Yes | 1 No |
Post New Answer View All Answers
What is sql engine in oracle?
What are the key differences between SQL and PL SQL?
What is %type in pl sql?
Which are sql * plus commands?
what is data manipulation language? : Sql dba
Are sql database names case sensitive?
How do we accept inputs from user during runtime?
what is the difference between truncate and delete statement? : Transact sql
Does mysql support pl sql?
What does desc stand for?
what are the difference between clustered and a non-clustered index? : Sql dba
What are the different parts of a package?
What are the triggers associated with image items?
How many tables can a sql database have?
Explain what is a column in a table?