Section: basic selects

Sort and limit results

sql
sql
SELECT id, email, created_at FROM users ORDER BY created_at DESC LIMIT 20;
Explanation

A common pattern for feeds, admin lists, and dashboards.

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 basic selects
Select all columns
Return all columns from a table.
OpenIn sheetsqlsame section
Select specific columns
Return only the columns you need.
OpenIn sheetsqlsame section
Filter rows with WHERE
Match rows using equality conditions.
OpenIn sheetsqlsame section
Return distinct values
Collapse duplicates in a result set.
OpenIn sheetsqlsame section
Search using LIKE
Match a string using wildcard patterns.
OpenIn sheetsqlsame section
Filter by date range
Return rows between two timestamps.
OpenIn sheetsqlsame section