GUIDE深度 · Deep dive

SQL SELECT Basics: WHERE, ORDER, LIMIT

A SELECT reads SELECT columns, FROM table, WHERE filter, ORDER BY sort, LIMIT rows. Get the structure right first, then optimize; use LIMIT to inspect a few rows when unsure.

更新 2026-10-30 · 公式可核验

Clause order

SELECT, FROM, WHERE, GROUP BY, HAVING, ORDER BY, LIMIT.

WHERE filters rows; HAVING filters groups.

Common mistakes

Quote strings with single quotes.

ORDER BY accepts a column or position.

LIMIT is not in standard SQL but is supported by SQLite, MySQL and Postgres.

FAQ

Is SELECT * good?

Fine for exploration; list columns in production.

Can WHERE use aliases?

Usually no; WHERE is evaluated before SELECT.

Sources

Related calculators

SQL Queries: 1000 Gamified SELECT Practice Cards1000 SQL query cards covering SELECT, WHERE, JOIN, GROUP BY, HAVING and subqueries, in 50 levels with spaced repetition.

More guides

Hiragana vs KatakanaRead guideSpaced Repetition and the Forgetting CurveRead guideOn Readings vs Kun ReadingsRead guideAn N5 Kanji Study OrderRead guide