Beginner

395. LIMIT Clause

Learn how to restrict the number of rows returned by a query using LIMIT.

📘 Lesson 395 of 728 ⏱ 8 min 🎯 Beginner

LIMIT restricts the number of rows returned by a query. It is commonly supported by databases such as MySQL, PostgreSQL, and SQLite.

Limiting results is useful when exploring large datasets or retrieving only a small number of records.

Return the first 10 employees.

SQL
SELECT
    *
FROM Employees
LIMIT 10;

Analysts use LIMIT during data exploration, testing, previewing results, and retrieving top records in supported database systems.

  • LIMIT restricts returned rows.
  • It is common in MySQL, PostgreSQL, and SQLite.
  • SQL Server uses TOP or OFFSET/FETCH instead.
  • LIMIT is useful for testing queries.
  • LIMIT does not delete records.
What does LIMIT do?

LIMIT restricts the number of rows returned by a query.

Is LIMIT standard across all SQL databases?

No. Different database systems may use different syntax for limiting rows.

Have you finished this lesson?

Introduction to SQL – All Lessons