use order by & limit in sql code example
Example 1: sql sort ascending limit
SELECT name
FROM column_names
ORDER BY name ASC
LIMIT 3;
Example 2: sql limit order by
SELECT expressions
FROM tables
[WHERE conditions]
[ORDER BY expression [ ASC | DESC ]]
LIMIT number_rows [ OFFSET offset_value ];