Originally posted by abhaysk
Jurij :

I wonder if this/any would work if max value of SAL is spread/duplicated.
Shure, they wil ALL work, why shouldn't they? (Hovewer the results you get from them might not be exactly what you have inspected ).

Anyhow, the original question is too general to be answered exactly - it must have been much more precise. We don't know exactly whar he wants. So even if it could be done with analytical functions, we still don't know which one of them to use: ROW_NUMBER(), RANK, DENSE_RANK ?

Anyway, to answer your question about the above queries and the "competing" values on the third position, let's say that the salaries in the sescending order are:

- EMP1: 10.000
- EMP2: 8.000
- EMP3: 5.000
- EMP4: 5.000
- EMP5: 5.000
- EMP6: 3.000

In this case the first query will list only EMP1 and EMP2, while the second and the third will list EMP1, EMP2 and *any ONE* of the remaining eployees that earn 5.000. So the second and the third query will alwways return three records, but in case of the equal salaries you dont know which one of those with the same rank will be displayed.