Execute SQL statements against SQLite databases in the browser
Synopsis
sqlite3 [database] <sql>
echo "SELECT 1" | sqlite3
Description
A browser-based SQLite interface powered by sql.js (SQLite compiled to WebAssembly). Executes SQL statements against an in-memory database or a database file stored on the virtual filesystem. If a database file exists at the given path, it is loaded; otherwise a new database is created. After executing write operations on a named database, the modified database is automatically saved back to the VFS.
Options
-h, --help Show usage information
Arguments
[database] Path to a SQLite database file on the VFS, or :memory: for an in-memory database (default: :memory:)
<sql> SQL statement(s) to execute, provided as trailing arguments or via stdin
Examples
$ sqlite3 "SELECT 1 + 1"
Run a query against an in-memory database.
$ sqlite3 mydb.sqlite "CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT)"
Create a table in a persistent database file on the VFS.
$ sqlite3 mydb.sqlite "INSERT INTO users VALUES (1, 'Alice')"
Insert data into a VFS-backed database.
$ echo "SELECT * FROM users" | sqlite3 mydb.sqlite
Pipe SQL through stdin.
Notes
Powered by sql.js, which compiles SQLite to WebAssembly. The WASM binary is loaded lazily from a CDN on first use. Output format uses pipe-delimited columns (e.g. 1|Alice), matching SQLite's default separator mode. Interactive mode is not supported — SQL must be provided as an argument or through stdin. The command is also registered under the alias sqllite (common misspelling).
See Also
commands