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?

Answers were Sorted based on User's Feedback



How do you retrieve the second highest salary from a table?..

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

How do you retrieve the second highest salary from a table?..

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

How do you retrieve the second highest salary from a table?..

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

More SQL PLSQL Interview Questions

What is mutating error in pl sql?

0 Answers  


What is query execution plan in sql?

0 Answers  


Can we create non-clustured index on a clustered index ?

4 Answers   TCS,


What are nested triggers ?

6 Answers   Amazon, Appeal Soft, IBM, Infosys, TCS,


what is the difference between char and varchar data types? : Sql dba

0 Answers  


What is a unique key?

0 Answers  


Is record in oracle pl sql?

0 Answers  


How do I view a view in sql?

0 Answers  


how to select first 5 records from a table? : Sql dba

0 Answers  


Is sql between inclusive?

0 Answers  


Write a query to get last 10 records from the table.

12 Answers   iNautix,


what is an index? : Sql dba

0 Answers  


Categories