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
What's the procedure?
What is difference between procedure and trigger?
Does inner join remove duplicates?
What is the difference between null value, zero, and blank space?
define sql insert statement ? : Sql dba
How to execute a stored procedure?
How many developers work on postgresql?
Can we use pl sql in sql server?
how to load data files into tables with 'mysqlimport'? : Sql dba
What does over partition by mean in sql?
What is difference between sql and excel?
Does group by remove duplicates?
What is group by in sql?
What are the datatypes available in pl/sql ?
Is sqlite thread safe?