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.
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.