SQL Cheat Sheet/Limit returned rows

Return only the first N rows.

Section: Sorting and Limiting

Limit returned rows

sql
sql
SELECT *
FROM logs
ORDER BY created_at DESC
LIMIT 50;
Explanation

LIMIT is widely supported, though standard SQL also supports FETCH FIRST.

Learn the surrounding workflow

Compare similar commands or jump into common fixes when this command is part of a bigger troubleshooting path.

Related commands

Same sheet · prioritizing Sorting and Limiting
Paginate with LIMIT and OFFSET
Skip rows and return a page-sized result set.
OpenIn sheetsqlsame section
Fetch first rows
Use standard SQL row limiting syntax.
OpenIn sheetsqlsame section
Sort rows
Order query results ascending or descending.
OpenIn sheetsqlsame section
Select all columns
Return all columns from a table.
Filter with equality
Return rows matching an exact value.
Inner join two tables
Return rows with matches in both tables.