The schema is the context
Every wrong SQL answer traces back to the same gap: the model guessed your columns. Paste the tables and their columns inline — 'users(id, email, created_at, plan)' is enough. This one line prevents more errors than any amount of instruction about writing good SQL.
Name the dialect and the version
Postgres 15, MySQL 8 and SQLite disagree about window functions, date arithmetic and upserts. A query that is correct in one is a syntax error in another. One clause — 'You are writing PostgreSQL 15' — removes a whole class of failure.
Say what a row means
Ask for the exact columns and their units: 'email, order count, and total in rupees to two decimals'. Money in particular goes wrong quietly — if the column stores paise and you wanted rupees, an unlabelled number is a bug you will find in production.