Basics · Lesson 6 of 19

Limiting Results with LIMIT

LIMIT restricts how many rows are returned.

Get the top 5 highest paid:

SELECT * FROM employees
ORDER BY salary DESC
LIMIT 5;

This is essential for:

  • Top N queries
  • Pagination
  • Testing queries on large tables

Always put LIMIT at the end of your query.

Check your understanding

Find the 3 highest-paid employees.

Examples run on the employees sample database. Open any of them in the playground to experiment.