How to Learn SQL in Your Browser — Free Practice with Real Databases
SQL Query Lab is a free, browser-based SQL editor that runs entirely client-side — no server, no installation, no account. It ships with 74 graded practice questions across three real database schemas (hospital, company, school) plus an unrestricted sandbox that runs INSERT, UPDATE, DELETE, and DDL. Everything executes locally in your browser.
What is SQL Query Lab and how does it work?
SQL Query Lab is a client-side SQL learning environment that runs SQLite in your browser via WebAssembly. It loads a pre-seeded database into memory, so queries execute in under 100 milliseconds with no network round-trip. It offers three modes: Practice, Sandbox, and MS SQL translation.
The WebAssembly engine is sql.js, a port of SQLite compiled to run in the browser. Practice mode gives structured challenges with automatic validation; Sandbox is a free-form scratchpad with auto-save; MS SQL mode translates SQLite syntax to T-SQL. A separate backend API (Node.js + Hono) handles real SQL Server connections only when you use Live mode.
SQL Query Lab vs other free SQL practice tools — feature comparison
The table below compares SQL Query Lab against three established free alternatives on dimensions that matter to learners and working developers.
| Feature | SQL Query Lab | W3Schools SQL | SQL Fiddle | db-fiddle |
|---|---|---|---|---|
| Graded practice questions | 74 questions, 3 databases | Inline tutorial exercises | None | None |
| Runs client-side (in-browser) | ✓ WebAssembly SQLite | ✗ Server-side | ✗ Server-side | ✗ Server-side |
| INSERT/UPDATE/DELETE practice | ✓ Sandbox + Practice | ✗ SELECT-focused | ✓ | ✓ |
| Live SQL Server connection | ✓ Via backend API | ✗ | ✗ | ✗ |
| T-SQL translation | ✓ SQLite → T-SQL | ✗ | ✗ | ✗ |
| ER diagram viewer | ✓ D3.js + Dagre | ✗ | ✗ | ✗ |
| No registration required | ✓ | ✓ | ✓ | ✓ |
Sources, verified June 2026: W3Schools SQL, SQL Fiddle, db-fiddle. All three execute queries on a hosted server; SQL Query Lab is the only one that runs the engine in the browser.
In summary, SQL Query Lab is the only tool in this set that combines graded questions, client-side execution, and a path to live SQL Server.
How do I get started with SQL Query Lab?
Open learn-sql-practice.vercel.app — the app loads instantly with a hospital database pre-selected. Press Cmd/Ctrl + Enter to run the query in the editor. Click All Questions to browse the 74 challenges by category or difficulty.
Categories cover SELECT, JOIN, aggregation, subqueries, and DML; difficulty ranges from easy to hard. Your progress and your sandbox database both save automatically to browser localStorage, so your work survives a browser restart.
What databases can I practice with in SQL Query Lab?
SQL Query Lab ships with three pre-seeded SQLite databases holding realistic relational data: hospital, company, and school. Use hospital for JOINs and date filtering, company for GROUP BY and window functions, and school for self-joins and subqueries. Click Reset DB to restore any database to its original seed state.
The hospital schema links patients, doctors, appointments, and billing. The company schema links employees, departments, projects, and salaries. The school schema links students, courses, enrollments, and grades. Switch between them with the dropdown in the top bar.
Can I practice MS SQL Server T-SQL syntax in SQL Query Lab?
Yes, in two ways. MS SQL mode translates your SQLite SQL into equivalent T-SQL — converting types (INTEGER → INT, TEXT → NVARCHAR, REAL → FLOAT), functions, and LIMIT/OFFSET into FETCH NEXT / OFFSET. Live mode connects to a real SQL Server instance so you can run T-SQL directly.
Live mode authenticates with Windows Authentication or SQL Server Authentication, and connection credentials are encrypted server-side before storage. It supports executing queries, viewing execution plans, and browsing the object explorer. For a syntax reference while you translate, see the SQLite language docs.
Is SQL Query Lab good for SQL interview preparation?
Yes. The 74 practice questions mirror common technical-interview patterns: multi-table JOINs, GROUP BY with HAVING, correlated subqueries, EXISTS versus IN, CTEs, and window functions. Each question shows the expected result set, and the comparison view highlights exact cell-level mismatches, so you self-verify without a reference answer.
The key takeaway: you can rehearse the query shapes interviewers actually ask, then use MS SQL mode to practice translating each one to T-SQL — the dialect used across most enterprise SQL Server environments.