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 does plv msg allows you to do?
What is the benefit of foreign key?
Explain normalization and what are the advantages of it?
What is pivot in sql?
What is an emotional trigger?
What does the hierarchical profiler does?
How do you write an index?
What is a sql*loader control file?
Suppose a student column has two columns, name and marks. How to get name and marks of the top three students.
What is execute immediate?
What is the difference between microsoft access and sql server?
Does view contain data?
What are the possible values for the boolean data field?
what are the difference between clustered and a non-clustered index? : Sql dba
What is Materialized View? In What Scenario we Use Materialized View?