Write a query to get 2nd maximum salary in an employee table ?
Answer Posted / anupam274
use AdventureWorks
select * from HumanResources.EmployeePayHistory e where
2 = (select count(distinct Rate) from
HumanResources.EmployeePayHistory where e.Rate<=Rate)
select * from HumanResources.EmployeePayHistory e where
4 >(select count(distinct Rate) from
HumanResources.EmployeePayHistory where e.Rate<=Rate)
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
How can you save or place your msg in a table?
How do you use join?
What is the difference between numeric and autonumber?
Which is the correct statement about truncate and delete?
When should I use nosql database?
what is a database transaction? : Sql dba
What is the difference between clustered and non-clustered index in sql?
Why do we use %rowtype & %type in plsql?
What are the key differences between SQL and PL SQL?
Why function is used in sql?
when is the use of update_statistics command? : Sql dba
What is a common use of group by in sql?
How do you rename a table in sql?
How do I remove sql developer from windows 10?
What is nosql example?