Data tools

Query a SQLite database

Run SQL against a .db / .sqlite file and read the answer as a table. The database never leaves your device.

Runs on your device. The file is never uploaded.

Query a SQLite database runs one SQL statement against a .db or .sqlite file and prints an aligned table. sql.js, SQLite compiled to WebAssembly, does the work, and the default statement lists the file's tables. The table stops at 1000 rows, and since the file is only ever read into memory, an INSERT is thrown away.

Input

Options

Questions

Does my database get uploaded?

No. The file is read into memory and opened by sql.js, a build of SQLite compiled to WebAssembly that runs inside the page. The query executes on your device, the results are formatted there, and the database is closed and freed from the WebAssembly heap when the run finishes. Nothing is sent to a server and there are no accounts.

Can I run an INSERT or an UPDATE?

You can run the statement, but the change goes nowhere. The database is opened from a copy in memory and no file is written back, so a write statement runs against that copy and is discarded when the run ends. You get "statement ran, no rows returned" because such a statement produces no columns. Treat this as a read tool.

Why do I only see 1000 rows?

Because that is the cap, and the tool tells you: "first 1000 rows only" with a suggestion to add LIMIT or WHERE. Rows past the cap are never even read, since the statement is stepped row by row rather than materialised in full, which is what stops a million row table from building a million line string in your browser.

Can I run several statements at once?

No, one statement per run. The default is a query that lists the tables in the file, which is a good first thing to run when you do not know the schema. Run your statements one at a time, reading the output of each before the next.

Why did I get "file is not a database"?

Because the bytes you gave it are not SQLite. That message comes from SQLite itself, prefixed with your file name, and it appears when the statement is prepared rather than when the file is opened, because SQLite only reads the header at that point. A zero byte file is caught earlier and refused with "file is empty", since SQLite would otherwise open it as a valid empty database and answer your query with silence.

How are BLOB and NULL values shown?

A NULL prints as NULL and a BLOB prints as its size, in the form <blob 2048 bytes>, because printing the raw bytes would produce a wall of numbers. Everything else is printed as text, padded into a plain aligned table. A long text value will wrap badly, since there is no maximum column width.

Related Data tools