Query a SQLite Database File Online
This workspace selects Current database and starts with a query listing tables, views and their schema SQL. Open a database file first, then press Run to inspect it. Replace the query with your own SQLite SELECT, join, CTE or write statement. Runs operate on the browser copy of the file; use the .sqlite button to keep changes.
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
- What happens if I press Run before opening a file?
- The current database is initially empty. The schema query returns no application tables. Open a compatible .db, .sqlite or .sqlite3 file, then run the query again.
- Can it execute joins and functions against my file?
- Yes. It uses SQLite 3.49.1, so ordinary SQLite joins, aggregates, window functions and built-in JSON functions run. ATTACH, external extensions and connections to other database engines are unavailable.
- Can I keep the file read-only?
- SQLite Viewer provides a read-only single-table browser. This playground permits write statements against its in-memory copy, so restrict your script to SELECT if you only want to read. It never overwrites the file on your disk.
- Can I open WAL or encrypted files?
- Open an ordinary unencrypted main database file of up to 10 MB. This workflow does not decrypt files or merge a -wal sidecar. Use a closed, checkpointed copy when your application uses WAL mode.
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.