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 are the types of queries in sql?

1122


How many triggers can be applied on a table?

985


What is a recursive stored procedure?

1251


what are the differences between char and varchar? : Sql dba

1113


Can a table contain multiple foreign key’s?

1049


What are the sql versions?

995


How do you declare a constant?

1015


Name some usages of database trigger?

1081


what is 'mysqld'? : Sql dba

1015


How do I run a sql script?

1224


what is offset-fetch filter in tsql? : Transact sql

998


What is sql injection vulnerability?

1005


What is the source code of a program?

1118


How do you change a value in sql?

1064


Explain the uses of control file.

1098