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 to raise user-defined exception with custom sqlerrm ?
What is the benefit of foreign key?
Is a table valued function object?
What is delimiter sql?
Why triggers are used?
What is bulk compiling in pl/sql.?
how to convert character strings to dates? : Sql dba
How can I tell if sql is running?
What is primary and foreign key?
What are different types of queries in sql?
What is the sql case statement?
Are stored procedures faster than dynamic sql?
Is truncate ddl or dml?
How to move files from one directory to another in pl sql?
When do we use triggers?