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

How to fetch alternate records from a table?

1244


What are analytical functions in sql?

1028


what is the difference between group by and order by in sql? : Sql dba

1128


Does sql use python?

1035


What is trigger in pl sql with examples?

1043


Is it possible to link two groups inside a cross products after the cross products group has been created?

1002


What do you understand by case manipulation functions?

1034


What is compiled query?

1037


Is primary key clustered index?

949


How do I start sql from command line?

1025


How do I partition a table in sql?

1131


what are myisam tables? : Sql dba

1032


Enlist the advantages of sql.

1001


State few characteristics of pl/sql?

971


What is the use of %rowtype?

1041