Write a query to get 2nd maximum salary in an employee table ?
Answer Posted / ashish jain
select Salary from
(
select salary,ROW_NUMBER() over (order by salary desc) as rownum from Emp group by salary) temp
where rownum=2
Note :It can be used to get any highest salary, just use where rownum=nth salary
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Can we commit in trigger?
How insert into statements in sql?
Why do we need databases?
What is the use of <> sql?
How do I audit the sql sent to the server?
What is the difference between alter trigger and drop trigger statements?
how to get a list of all tables in a database? : Sql dba
What are the different types of tables in sql?
What are literals in sql server?
When is a declare statement required?
How do you exit in sql?
Can we create clustered index without primary key?
What is rowtype?
How you can copy a file to file content and file to pl/sql table in advance pl/sql?
What does select count (*) mean in sql?