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

what are the authentication modes in sql server? : Sql dba

1121


How do you modify a table in sql?

1165


Mention what problem one might face while writing log information to a data-base table in pl/sql?

1287


What is record type in pl sql?

1036


How do you use join?

995


What is a stored procedure in sql with example?

1201


Can a procedure in a package be overloaded?

1102


what is sql profiler? : Sql dba

1115


What is sql clause?

1092


Explain some predefined exceptions.

1093


What is varchar sql?

1207


Is pl sql useful?

1037


how to write date and time literals? : Sql dba

1010


what is a trigger in mysql? : Sql dba

1216


What are the operators in sql?

1070