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's the procedure?
Why is pl sql needed?
how to start mysql server? : Sql dba
What is where clause in sql?
How many rows can sqlite handle?
what is text? : Sql dba
What are few of the schema objects that are created using PL/SQL?
What do you think about pl/sql?
how to increment dates by 1 in mysql? : Sql dba
Why triggers are used?
Explain alias in sql?
Can we use join in subquery?
What is an emotional trigger?
What is nvarchar in sql?
What does (*) mean in sql?