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

HI, this querey is showing the output for the employees
salary. for the which employees salary is highest in that
table this query showing the output.

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is t-sql? : Transact sql

981


What is the process of debugging?

1061


Define SQL and state the differences between SQL and other conventional programming Languages?

1206


What is primary key secondary key alternate key candidate key?

1031


What are %type and %rowtype for?

1050


What mean sql?

1000


Is primary key clustered index?

945


what is a trigger in mysql? : Sql dba

1144


How to install oracle sql developer?

1042


How do I edit a trigger in sql developer?

990


Explain about various levels of constraint.

939


What is the command used to fetch first 5 characters of the string?

1390


Why procedure is used in sql?

1032


What is sql prepared statement?

976


What is scalar function in sql?

1037