SQLite Playground
An online SQL compiler for SQLite: create tables, insert rows, run joins and transactions in your browser, then download the database. Each run gets a fresh worker that stops at 2 seconds, and you can open your own SQLite file of up to 10 MB.
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
- Which SQL does this online compiler run?
- SQLite 3.49.1, the real engine compiled to WebAssembly by sql.js 1.14.2, so the dialect is SQLite's. Window functions, common table expressions, UPSERT and the JSON functions work. MySQL, PostgreSQL and SQL Server features that SQLite lacks fail with SQLite's own message, and SHOW, DESCRIBE, NOW(), GETDATE(), SELECT TOP and dot commands such as .tables get a hint naming the SQLite way.
- Does the database stay between runs?
- You choose. With Empty database, the default, every run starts from nothing, so a script can be run again and again. With Current database, each run starts from the database the last run left, or from a file you opened. Either way the database lives in this tab only: reloading the page or pressing Reset empties it, so download it with the .sqlite button to keep it. The script and that choice are remembered in this browser; the database never is.
- What happens with an infinite loop or a very slow query?
- Each run gets a fresh worker, and the page ends it after 2 seconds of running. The database then goes back to exactly how it was before that run, because only a run that finishes replaces it. Stop does the same at any moment, and the page stays usable throughout.
- Can I open my own SQLite database file?
- Yes. Open a database file reads a SQLite file of up to 10 MB (10,485,760 bytes) from your device, checks its header and runs SQLite's quick check, then lists its tables and switches runs to start from it. The .sqlite button downloads it with your changes. The file is never uploaded.
- How do transactions work here?
- BEGIN, COMMIT, ROLLBACK and SAVEPOINT behave as they do in SQLite, within one run: the BEGIN, INSERT, ROLLBACK example shows the row count going from 4 back to 3. A run that ends inside an open transaction, including one stopped by an error, is rolled back, and the result says so.
- Are results or databases limited in size?
- A script can be up to 64 KB. Each result shows its first 1,000 rows, a run shows up to 20 results and 50,000 values in all, and a long text value shows its first 1,000 characters, with a note wherever something was cut. A database stays within 10 MB, and SQLite may use up to 128 MB of memory during a run.
- What can it not do?
- It cannot connect to MySQL, PostgreSQL or any server, attach a second database file, or load extensions: ATTACH and DETACH are turned off, and load_extension() does not exist in this build. Temporary tables last only for the run that creates them.
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.