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 t-sql? : Transact sql
What is the process of debugging?
Define SQL and state the differences between SQL and other conventional programming Languages?
What is primary key secondary key alternate key candidate key?
What are %type and %rowtype for?
What mean sql?
Is primary key clustered index?
what is a trigger in mysql? : Sql dba
How to install oracle sql developer?
How do I edit a trigger in sql developer?
Explain about various levels of constraint.
What is the command used to fetch first 5 characters of the string?
Why procedure is used in sql?
What is sql prepared statement?
What is scalar function in sql?