SQL Practice Online with an Employee Table
This SQL practice workspace starts with four employees and two departments. Press Run to create the tables and see three result sets: a salary-filtered join, average salaries by department, and a running total. Edit the queries or add your own INSERT statements. Empty database rebuilds the dataset each time, so experiments start from the same data.
Press Run, or Ctrl+Enter in the editor. The first run downloads the 643.0 KB SQLite engine from this site and checks it against a pinned SHA-256 hash.
- Engine
- SQLite 3.49.1
- Time limit
- 2 s a run
- Limits
- 64 KB SQL, 10 MB file
- Result
- none yet
Ctrl+Enter (Cmd+Enter on a Mac) runs the script. It holds up to 65,536 bytes (64 KB) and is kept in this browser until you press Reset. The database is held in this tab only and is never saved, so download it with the .sqlite button to keep it.
Tables in the database
No database yet. Run a script that creates a table, or open a SQLite file of up to 10 MB.
Examples
Each one loads into the editor, and the result beside it is what running it gives.
- 2 joined rows: Ada 19.5, Grace 42.75
- SELECT COUNT(*) FROM orders still returns 3
- stopped at 2 s, the database as it was before the run
- 3 rows, running_total 120, 200, 400
- free 1, pro 1
What SQLite here can and cannot do
The engine is the real SQLite. These are the edges this page adds or keeps.
- MySQL, PostgreSQL and SQL Server features that SQLite lacks fail with SQLite's own message, and SHOW, DESCRIBE, NOW(), GETDATE(), SELECT TOP and the shell's dot commands get a hint naming the SQLite way.
- ATTACH and DETACH are turned off, and nothing here connects to a server or to any other database.
- load_extension() does not exist in this build, so no extension can be loaded.
- A run that takes longer is stopped: its worker is replaced and the database goes back to how it was before the run.
- Each result shows up to 1,000 rows, a run shows up to 20 results and 50,000 values in all, and a text value shows its first 1,000 characters. A note marks anything cut.
- SQLite may use up to 128 MB of memory, and a database stays within 10 MB: an INSERT that would pass it fails with database or disk is full, and a run that ends larger is not kept.
- Each run starts a new SQLite, so a CREATE TEMP TABLE is gone when its run ends. Use a normal table with Current database to keep data.
Engine and licence
SQLite is in the public domain (sqlite.org/copyright.html). It is compiled to WebAssembly by sql.js 1.14.2, MIT licensed by the sql.js authors, whose JavaScript this page bundles. Both load the first time you run a script or open a file. The engine file is served from this site unmodified; the licence file holds the complete sql.js notice.
| File | What it is | Size | Licence | SHA-256 |
|---|---|---|---|---|
| sql-wasm.wasm | SQLite 3.49.1 compiled to WebAssembly by sql.js, package/dist/sql-wasm.wasm (downloaded when first needed) | 658,410 bytes | MIT (sql.js); SQLite itself is public domain | 38c14f6e379210bc942bdc4ebca44e7bfdb4318ecc1c72ca666a28fdce96670a |
| sqljs-LICENSE.txt | The sql.js licence notice, package/LICENSE | 2,199 bytes | MIT | 60a3f6e4d7b29b4321359e683b36cf198d24f58e24582070f56e6fa89d5ee2be |
Databases up to 10 MB (10,485,760 bytes) open from your device and are never uploaded.
Common questions
- Is the practice database already running?
- The script is prefilled but runs only when you press Run. It creates employees and departments, inserts sample rows, then returns three result tables.
- Can I reuse just the SELECT queries?
- Run the full script once, choose Current database, then replace the script with SELECT statements. Do not rerun CREATE TABLE against those existing tables unless you drop them or use an appropriate IF NOT EXISTS workflow.
- Is this MySQL, SQL Server or Oracle practice?
- It runs SQLite only. The sample demonstrates SQL features available in SQLite; vendor-specific procedural SQL and dialect differences need their target engine.
- Are there graded questions or interview answers?
- No. This is an editable execution workspace with a sample dataset, not a course, automatic grader or complete interview question bank.
Runs the SQLite dialect only, SQLite 3.49.1 through sql.js 1.14.2, in a worker in your browser: there is no connection to MySQL, PostgreSQL or any other database, and extensions cannot be loaded. Every run gets a fresh worker that is stopped at 2 seconds, and each result shows its first 1,000 rows at most, with a note when rows were cut. Scripts up to 64 KB and database files up to 10 MB stay on your device.