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 / hr@tgksolutions.com

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

Can we use ddl statements in stored procedure sql server?

992


What is difference between sql and mysql?

1100


what is data manipulation language? : Sql dba

993


How to handle bulk data?

1300


What is sql*loader and what is it used for? : aql loader

1149


What is the use of index in sql?

996


what are the different type of sql's statements ? : Sql dba

906


how can we know the number of days between two given dates using mysql? : Sql dba

1031


What is a parameter query?

1061


what is heap table? : Sql dba

1093


How to select all records from the table?

1119


What is sql used for?

1101


What is raw datatype in sql?

1030


What is trigger explain with example?

1018


What is thread join () in threading?

1001