SQLite DDL and Schema Design Cheatsheet
CREATE TABLE, constraints, generated columns, foreign keys, defaults, and schema design patterns for production SQLite databases.
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all
## Create tables and constraints
## Change schemas safely
BEGIN; CREATE TABLE users_new ( id INTEGER PRIMARY KEY, email TEXT NOT NULL UNIQUE, full_name TEXT, timezone TEXT ); INSERT INTO users_new (id, email, full_name, timezone) SELECT id, email, display_name, timezone FROM users; DROP TABLE users; ALTER TABLE users_new RENAME TO users; COMMIT;
# Canonical pattern for dropping constraints or changing types.
More in SQLite
SQLite Triggers, Views, and Generated Columns Cheatsheet
CREATE VIEW, CREATE TRIGGER, audit logging, derived values, generated columns, and automation patterns in SQLite.
SQLite Full-Text Search (FTS5) Cheatsheet
FTS5 virtual tables, MATCH queries, prefix search, phrase search, bm25 ranking, snippets, and highlighting patterns for SQLite search features.
SQLite PRAGMA and Administration Cheatsheet
High-signal PRAGMA commands for foreign keys, cache, synchronous settings, page size, temp storage, health checks, and general SQLite administration.
SQLite JSON Functions Cheatsheet
json_extract, json_set, json_each, JSON operators, generated columns, and practical JSON query/update patterns in SQLite.
SQLite Import, Export, and Backup Cheatsheet
CSV import/export, SQL dumps, VACUUM INTO, backup copies, and repeatable data movement patterns for SQLite databases.
SQLite Transactions, WAL, and Locking Cheatsheet
BEGIN modes, COMMIT and ROLLBACK, savepoints, WAL mode, busy timeouts, and concurrency patterns for SQLite applications.