Skip to main content
SQL • LESSON 58

LIMIT

How can we return only the first few rows?

Beginner3 Minutes710 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