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
What is pessimistic concurrency control? : Transact sql
what is a scheduled jobs or what is a scheduled tasks? : Sql dba
What are the limitations of sql express?
Why use subqueries instead of joins?
What is the difference between local variables and global variables?
what is sp_pkeys? : Transact sql
Do triggers have restrictions on the usage of large datatypes, such as long and long raw?
What is sql constant?
Explain how exception handling is done in advance pl/sql?
What is pl/sql language case sensitive?
How do we use distinct statement? What is its use?
What is sql*loader?
What is data definition language?
what are tables and fields? : Sql dba
What is use of package in pl sql?