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

What does := mean in pl sql?

1031


What are the types of join and explain each?

1023


What makes a good primary key?

1017


What type of database is sql?

1017


What is procedure explain with example?

942


What is basic structure of pl sql?

1054


what are ddl statements in mysql? : Sql dba

1175


What is a subquery in sql?

1026


What is input buffer in sql*plus?

1195


What port does sql server use?

1047


how to shut down the server with 'mysqladmin'? : Sql dba

993


Why procedure is used in sql?

1028


If i can use sys.check_constraints to display my constraints from my database using sql server 2005, how can i display then if i am using sql server 2000????

3991


What is sql trigger example?

1035


Is inner join same as self join?

1107