Skip to main content
SQL โ€ข LESSON 58

LIMIT

How can we return only the first few rows?

Beginnerโฑ 3 Minutesโญ 710 XP
๐Ÿค” THE QUESTION

How can we return only the first few rows?

๐Ÿ’ก WHAT IS IT?

LIMIT constrains the maximum number of rows returned by the database engine.

๐ŸŽฏ WHAT IS IT USED FOR?

Pagination, previewing query results, high-performance sampled analytics.

๐Ÿ’ป EXAMPLE
SELECT name, salary
FROM employees
ORDER BY salary DESC
LIMIT 10;

๐ŸŽฏ Mission Objectives

Practice typing production-grade SQL code for LIMIT.

  • โœ“ LIMIT clause
  • โœ“ Row capping
  • โœ“ Pagination preview
  • โœ“ Efficient queries