SELECT r, e2.* FROM (SELECT rownum AS r, e1.* FROM (SELECT * FROM emp ORDER BY sale ) e1 WHERE rownum <= 8 ) e2 WHERE r >= 5;