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 / glibwaresoftsolutions

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

Why is sql*loader direct path so fast?

1052


What is view explain with example?

879


what is the difference between delete and truncate statement in sql? : Sql dba

1121


Explain how you can copy a file to file content and file to pl/sql table in advance pl/sql?

954


What is forward declaration in pl sql?

1005


How do I partition a table in sql?

1037


Is progress software supports to ( pl/sql )?

968


what is a trigger in mysql? : Sql dba

1065


How many indexes can be created on a table in sql?

983


What is the difference between microsoft sql and mysql?

919


How do sql triggers work?

982


Is record in oracle pl sql?

901


What are the different sql languages?

984


Which query operators in sql is used for pattern matching?

901


What is pivot in sql?

870