30 days · 90 hands-on drills · real SQLite running in your browser · instant result-set grading
A free, no-install SQL practice site for new grads and students hunting for internships and entry-level data roles. Learn a concept, write a query, get graded right away, then review the answer and the common interview traps.
👉 Try it now: https://liuyizhou0402.github.io/sql-interview-console/
The UI and lesson text are in Simplified Chinese. The SQL, table names and column names are standard English.
Most SQL tutorials stop at SELECT * FROM table. Entry-level data interviews ask for more:
- retention and cohort tables
- "top N per group"
- consecutive-day streaks
- A/B test readouts
- spotting the bug that silently doubles your revenue after a JOIN
This console is built around those questions. Each lesson is designed to take one focused day, and each drill uses the same business dataset, so by Day 30 you have worked through a full analytics case end to end.
| Real engine, zero setup | sql.js (SQLite compiled to JavaScript) runs entirely in the browser. No sign-up, no server, no database to install. |
| Grades results, not text | Your query and the reference answer both run against the same database, and the result sets are compared. Any correct approach passes: CTE, subquery or window function. When the result is wrong, it shows the first mismatched row and column. |
| Realistic, messy data | 50,000+ rows across 7 tables (users, events, orders, order_items, items, employees, ab_assignment). Real-world problems are built in: duplicate tracking events, ~6% NULL payment methods, a weak acquisition channel, and employees who out-earn their managers. |
| A debrief after every drill | Each drill comes with a reference answer, an explanation, the most common trap, and how to talk about it in an interview. |
| Progress and mistake log | Progress, first-try rate and a mistake log are saved locally in your browser (localStorage). |
| Week | Theme | Days |
|---|---|---|
| 1 · Foundations | Querying and aggregation | SELECT/WHERE/ORDER BY · GROUP BY · CASE WHEN funnels · dates · NULL three-valued logic · subqueries |
| 2 · Joins | Combining tables | JOIN family · row explosion · self-joins · CTEs · UNION/EXCEPT/INTERSECT · de-duplication and data quality |
| 3 · Window functions | Detail and aggregates together | PARTITION BY · ROW_NUMBER/RANK/DENSE_RANK and Top-N · LAG/LEAD · running totals · window frames and moving averages · NTILE and median |
| 4 · Interview-style cases | Product-analytics problems | Retention · cohort matrix · gaps-and-islands · sessionisation · recursive CTEs · query optimisation · A/B test analysis · 2 mock interview days |
Days 7, 14 and 21 are review days that bring the week's skills together. Drills are tagged Beginner / Intermediate / Interview-level.
- Read the concept card (~10 min).
- Attempt all 3 drills without hints. A first-try pass is worth more than a pass after several tries.
- If you are stuck, use Hint, then Answer & Debrief.
- Review the mistake log the next morning and re-solve yesterday's misses from scratch.
- On mock-interview days, explain your query out loud as if an interviewer were listening.
index.html # built single-file app (served by GitHub Pages)
_p1_shell.html # layout and design tokens (light/dark)
_p2_engine.html # schema, deterministic data generator, result-set comparator
_p3_week1.html … # curriculum: concepts + drills (prompt, starter, ref, hint, debrief, trap, interview tip)
_p6_week4.html
_p7_app.html # rendering, grading flow, progress, mistake log
build.sh # concatenates the parts into index.html
e2e.js # runs all 90 reference answers against the generated DB and checks data invariants
validate.py # lightweight SQLite syntax check
./build.sh # rebuild index.html
node e2e.js # verify: 90/90 reference answers execute, data invariants hold
open index.htmlAppend an object to the relevant week file:
{id:"15-4", diff:2, tag:"PARTITION", ordered:true,
prompt:"…", starter:"SELECT …", ref:"SELECT …",
hint:"…", debrief:"<p>…</p>", trap:"…", ivw:"…"}You only write the reference query. Expected output is computed automatically. Run node e2e.js before pushing.
- Data: all data is synthetic and generated deterministically in the browser. No real company or user data is used.
- SQL dialect: SQLite. Window functions, CTEs and recursive CTEs behave the same as in PostgreSQL, MySQL 8, BigQuery and Snowflake for the patterns taught here; date functions differ between dialects.
- Built with AI assistance: I designed the curriculum, dataset scenarios and grading approach with the help of Claude Code, and verified them with an end-to-end test script.
Feedback, bug reports and new drill ideas are welcome. Please open an issue.
中文简介
SQL 面试速成台是给应届生和找实习的同学准备的免费 SQL 练习网站,打开浏览器就能用,不用注册,也不用装数据库。
- 30 天、90 道实战题,分四周:语法地基 → 连接与组装 → 窗口函数 → 大厂实战(留存、Cohort、连续登录、会话切分、AB 实验、模拟面试)
- 真 SQLite 在浏览器里运行。判题比的是结果集,写法不同但结果对就算通过;结果不对时会指出是第几行、哪一列不一致
- 每题都有复盘:参考答案、易错点,以及「面试怎么用」
- 进度、一次通过率和错题本自动保存在本地浏览器
建议每天:读概念卡 → 不看提示先做 → 卡住再看提示 → 看复盘 → 第二天早上重做错题。
