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 mutating trigger?
Why is %isopen always false for an implicit cursor?
what is self-join? : Sql dba
How do we accept inputs from user during runtime?
difference between anonymous blocks and sub-programs.
What is view explain with example?
Can we connect to postgresql using sql developer?
how to run 'mysql' commands from a batch file? : Sql dba
Why having clause is used in sql?
Which command is used to call a stored procedure?
Whis is not false in primary key?
How do you explain an index number?
How do I create a sql script?
What is a left join?
Write the alter statement to enable all the triggers on the t.students table.