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
What is difference between ms sql and mysql?
What are %type and %rowtype for?
What are the differences between in and exists clause?
What is a primary key called that is made up of more than one field?
how to use myisamchk to check or repair myisam tables? : Sql dba
What is sqlite used for?
What is the function that is used to transfer a pl/sql table log to a database table?
State some properties of relational databases?
What operating systems are supported by oracle sql developer?
What are system versioned tables?
What are the two types of cursors in pl sql?
What is view explain with example?
What is the use of desc in sql?
What is a data definition language?
Which join condition can be specified using on clause?