SQLite
Overview
SQLite is a serverless, embedded SQL database stored in a single file—ideal for mobile apps, browser storage (via WASM), local tools, and low-traffic web stacks (sometimes with write limitations). It implements most of SQL with ACID transactions per connection discipline.
Key concepts
- Single writer — One writer at a time; many readers otherwise.
- File format — Portable
.sqlitedatabase file. - Types — Dynamic typing with affinity rules.
- WAL mode — Write-ahead logging for concurrency/performance.
- When not to use — High write concurrency across many clients—consider client/server DB.
App ↔ SQLite
Sample: CLI session
.open local.db
CREATE TABLE notes (
id INTEGER PRIMARY KEY,
body TEXT NOT NULL
);
INSERT INTO notes (body) VALUES ('buy milk');
SELECT * FROM notes;