Practice SQL against real PostgreSQL — in your browser. Problems are generated on demand by your local Claude Code subscription. Open source, runs entirely on your machine.
No accounts, no hosted database, no API keys. Clone it, run it, practice.
Most SQL practice gives you a prompt and an answer — but no table to look at and no way to actually run your query. SQL Drill spins up a real Postgres database (PGlite/WASM) in the browser for every problem, so you see the actual tables, real error messages, and result-set grading.
- Real Postgres in the browser — PGlite runs an in-memory Postgres per problem (schema + seed data loaded for you).
- AI-generated problems — a thin local backend calls
claude -pto generate a{schema, seed, prompt, solution}problem, then runs it through PGlite to verify it works before it ever reaches you (self-repairs up to 2× on failure). - Deterministic grading — your result set is compared to the reference solution's. No LLM needed to tell you right from wrong.
- Chat tutor — ask "what's a window function?", get hints, or have your wrong answer diagnosed — all in one conversational panel that sees the problem, schema, and your current query.
- Node 20+
- Claude Code installed and logged in
(
/logindone). The backend callsclaude -pto generate problems, reusing your existing subscription — so there's nothing extra to pay or configure.
npm install
npm run dev # starts the web app (Vite) + local backend (Express) togetherThen open the printed localhost URL. Pick a topic/difficulty, get a problem, write
SQL, run it, and get graded.
npm run dev:web # frontend only
npm run dev:server # backend only
npm run build # production build
npm run typecheck # tsc --noEmit[Browser: Vite + React + TS]
PGlite (WASM) real Postgres, one in-memory DB per problem
CodeMirror SQL editor
grading compare your result set vs the reference solution (deterministic)
│ POST /api/generate
[Local backend: Express]
execFile("claude", ["-p", prompt, "--output-format", "json"])
→ validates the generated problem against PGlite, self-repairs, returns it
The browser only ever receives problems that have been executed and verified server-side.
Early but usable (v0.0.1). Core loop — generate → see tables → run → grade — works
end to end, plus the chat tutor. Hosted / bring-your-own-API-key versions are possible
later; today it's a local tool. Issues and PRs welcome.
MIT recommended. Add a LICENSE file (with your name) before making the repo public.