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...

Hi,

Can anybody please explain me the flow of the below query.
I am not able to understand how this query works.

This query is for finding the Nth highest salary..

SELECT DISTINCT (a.sal)
FROM EMP A
WHERE &N = (SELECT COUNT (DISTINCT (b.sal)) FROM EMP B
WHERE a.sal<=b.sal);

If N = 2 then second highest salary will be the o/p.
If N = 3 then third highest salary will be the o/p.
and so on..

Thanks,
Nitin

Answer Posted / nitin

Thank you.

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many columns should be in an index?

963


Why primary key is required?

1006


What is sap sql anywhere?

1077


Can you do multiple joins in sql?

1052


What is a column in a table?

1125


Is join an inner join?

974


What is a sql select statement?

1040


Define select, insert, create, delete, update, drop keywords

1048


What's the difference between a primary key and a clustered index?

986


what is union? : Sql dba

1027


What is oracle sql called?

922


explain mysql aggregate functions. : Sql dba

989


What are the advantages of sql?

1055


Mention what are the benefits of pl/sql packages?

1080


how to include comments in sql statements? : Sql dba

955