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
How much does a sql dba make? : SQL DBA
What type of database is sql?
How do you go back in sql?
Do we need commit after truncate?
Why is a primary key important?
define sql delete statement ? : Sql dba
What are the disadvantages of file system?
how do you know the version of your mysql server? : Sql dba
what are properties of a transaction? : Sql dba
What packages are available to pl/sql developers?
Why use truncate instead of delete?
What is user defined functions?
Explain the uses of control file.
Is grant a ddl statement?
What are the types pl/sql code blocks?