Since version 12c Oracle supports the SQL:2008 Standard, which provides the following syntax to limit the SQL result set:
SELECT
title
FROM
post
ORDER BY
id DESC
FETCH FIRST 50 ROWS ONLY
Prior to version 12c, to fetch the Top-N records, you had to use a derived table and the ROWNUM
pseudocolumn:
SELECT *
FROM (
SELECT
title
FROM
post
ORDER BY
id DESC
)
WHERE ROWNUM <= 50