SQLite Playground
Run SQL queries against a SQLite database right in your browser. Create tables, import or export .sqlite and .db files, and browse the results in a sortable table.
Input
| Name | Type | Columns |
|---|---|---|
| This database has no tables yet. | ||
Output
| Result 1 |
|---|
| No results yet |
Readme
What is SQLite?
SQLite is a small, self-contained SQL database engine. An entire database lives in a single file, which is why it is used everywhere: in mobile apps, web browsers, desktop software, and as a simple format for sharing structured data. Files usually end in .sqlite, .sqlite3, or .db.
Tool description
This SQLite playground runs a real SQLite engine, compiled to WebAssembly, directly in your browser. Write SQL in the editor, press Run, and see the results in a sortable table. Start from an empty database, or import an existing .sqlite or .db file, change it, and export it again. Nothing is uploaded: the database only exists in your browser tab.
Examples
CREATE TABLE books (id INTEGER PRIMARY KEY, title TEXT, year INTEGER);
INSERT INTO books (title, year) VALUES
('Dune', 1965),
('Neuromancer', 1984);
SELECT * FROM books WHERE year > 1970;Features
- Runs one or many SQL statements at once, and shows the rows from each statement in its own result table
- Import a SQLite database file with the Import button
- Export the database, including your changes, back to a
.sqlitefile - Lists the tables and views in the database with their columns; click one to query it
- Starts empty; the Insert demo data button adds a small
employeestable so you can try queries right away - Sortable result tables that you can also download as CSV or JSON
- Shows
NULLvalues clearly and BLOB values as hex - Warns before you discard changes you have not exported
How it works
The tool uses sql.js, the official SQLite source compiled to WebAssembly. When you run a query, the whole script is executed against an in-memory copy of the database. Importing a file loads it into memory, and exporting writes the current in-memory database back out as a standard SQLite file that any SQLite tool can open.
Tips
- Press Ctrl+Enter (Cmd+Enter on Mac) in the editor to run the query
- Changes only exist in your browser tab, so export the database before you close or reload the page
- If a statement in a script fails, the statements before it have already run and their changes stay in the database
- Result tables show the first 1000 rows; use
LIMITandOFFSETto page through larger results - SQLite integers are 64-bit, but the results are shown as JavaScript numbers, which are exact only up to 9,007,199,254,740,991. Use
CAST(column AS TEXT)to see the exact value of larger integers - Foreign key enforcement is off by default in SQLite; run
PRAGMA foreign_keys = ON;to turn it on - A very slow query, such as an endless recursive query, can freeze the tab until it finishes, so reload the page if that happens
- Encrypted SQLite files (for example SQLCipher) cannot be opened