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

explain access control lists. : Sql dba

1001


Is not null in sql?

997


what is sub-query? : Transact sql

1105


Is join same as left join?

1041


Is sql dba a good career? : SQL DBA

992


What is vector point function?

1054


what are the maximum number of rows that can be constructed by inserting rows directly in value list? : Transact sql

952


What do you mean by dbms? What are its different types?

1018


Is t sql a programming language?

1069


What is bulk compiling in pl/sql.?

1130


What are the types of join in sql?

1103


What are the two types of exceptions.

1171


Why do we create views in sql?

1154


how to enter binary numbers in sql statements? : Sql dba

974


Which normal form is best?

948