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...

How do you retrieve the second highest salary from a table?

Answer Posted / nashiinformaticssolutions

Using a subquery:
SELECT MAX(salary)
FROM employees
WHERE salary < (SELECT MAX(salary) FROM employees);
Using ROW_NUMBER():
SELECT salary
FROM (
SELECT salary, ROW_NUMBER() OVER (ORDER BY salary DESC) AS row_num
FROM employees
) ranked
WHERE row_num = 2;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how to check myisam tables for errors? : Sql dba

1256


Are stored procedures faster than queries?

895


What is difference between nchar and nvarchar?

953


What is the difference between execution of triggers and stored procedures?

1047


What is the purpose of design view?

948


Is the primary key an index?

981


Explain the the delete statements in sql?

974


How do you pronounce sql?

951


What is the left table in sql?

910


What is the difference between clustered and non-clustered indexes?

1025


What is sql stand for?

944


Why is a trigger used?

885


What are analytical functions in sql?

965


What is a constraint? Tell me about its various levels.

1081


What are the ddl commands?

947