oracle sql limit code example
Example 1: oracle sql limit results
SELECT * FROM ( SELECT * FROM emp ORDER BY sal DESC ) WHERE ROWNUM <= 5;
SELECT * FROM emp ORDER BY sal DESC FETCH FIRST 5 ROWS ONLY;
Example 2: oracle limit rows
SELECT *
FROM sometable
ORDER BY name
OFFSET 20 ROWS FETCH NEXT 10 ROWS ONLY;
Example 3: SQL SELECT TOP Equivalent in oracal
syntax -> SELECT column_name(s)
FROM table_name
WHERE ROWNUM <= number
SELECT *
FROM Persons
WHERE ROWNUM <=5
Example 4: limit rows after order by oracle
oracle limit rows