I would like to select 3rd salary from TABLE employees. I have written QUERY as you may see below but unfortunately it gives me 0 record. Can somebody help me on this topic ? I am using Oracle DBMS :) and here is an example of my database: SQL Fiddle
SELECT *
FROM
(SELECT ROWNUM, salary
FROM
(SELECT DISTINCT salary
FROM employees
ORDER BY salary desc)
)
WHERE ROWNUM = 3;
In standard SQL, most databases, and Oracle 12C+, you can instead use:
SELECT DISTINCT salary
FROM employees
ORDER BY salary desc
OFFSET 2 ROWS FETCH NEXT 1 ROW ONLY;