Skip to main content

How do you return only the first 10 records?

To return only the first 10 records, the LIMIT keyword is used in SQL.

Example:

sql
SELECT * FROM Employees LIMIT 10;

What this query does

  • Returns the first 10 rows of the Employees table.
  • The rest of the records are ignored.

Tips:

  • Usually paired with ORDER BY, to define which records count as "first":
sql
SELECT * FROM Employees ORDER BY Age DESC LIMIT 10;
  • Different DBMSs can also use TOP (SQL Server):
sql
SELECT TOP 10 * FROM Employees;

Put simply, LIMIT 10 lets you pull just the first 10 records from a table, in the given order.

Short Answer

Interview ready
Premium

A concise answer to help you respond confidently on this topic during an interview.