Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

How to raise user-defined exception with custom sqlerrm ?

1132


What is the benefit of foreign key?

1022


Is a table valued function object?

1025


What is delimiter sql?

1013


Why triggers are used?

993


What is bulk compiling in pl/sql.?

1136


how to convert character strings to dates? : Sql dba

1065


How can I tell if sql is running?

1067


What is primary and foreign key?

1065


What are different types of queries in sql?

1121


What is the sql case statement?

1011


Are stored procedures faster than dynamic sql?

1046


Is truncate ddl or dml?

993


How to move files from one directory to another in pl sql?

1196


When do we use triggers?

1084