The shape of every read
Every query that reads from a SQLite database starts with SELECT. The minimal shape:
SELECT <columns> FROM <table> [WHERE <predicate>] [ORDER BY ...] [LIMIT N]Things to internalize on day one:
SELECT *is fine for exploration but never in production code — it ties your application to whatever the schema happens to look like today.- Column expressions can be raw columns, expressions, function calls, or string concatenations.
AScreates an alias — a temporary name that's local to the query. Use it for derived columns and self-joins.- You can SELECT without any FROM at all:
SELECT 1+1,SELECT datetime('now')— useful for one-shot checks.
Tip: Develop the muscle of explicit columns from day one. Every
SELECT * in production code is a future bug — when someone adds a sensitive column or reorders the schema, your code breaks silently or leaks data.