Kamran Mushtaq
Back to Database
Database

LIMIT

Added: June 23, 2026

Definition

LIMIT is a SQL clause used to restrict the number of rows returned by a query.

What Problem It Solves

It solves the need to control result size, improve performance, and fetch only required records (e.g., top N results).

What Happens If Not Used

The query returns all matching rows, which may be large, slow, or unnecessary.

Easy Wording

It “cuts down results to a fixed number.”

Technical Example

Show only top 5 students from a class instead of the full list. SELECT name, marks FROM students ORDER BY marks DESC LIMIT 5; Result: only 5 highest-scoring students are returned.