SQLite: Embedded Databases Done Properly
The most deployed database in the world, treated as an engineering subject - affinity, WAL, FTS5 and recovery.
SQLite is the most widely deployed database engine in existence - in every phone, every browser, most aircraft, and inside a large fraction of the applications on your machine. It is also the most frequently underestimated, because "embedded" is heard as "toy" and the engine is in fact one of the most rigorously tested pieces of software ever written, with an aviation-grade test suite running hundreds of millions of assertions.
Overview
This course treats those constraints as the subject. You will meet type affinity, which lets a text value into an integer column and is the single biggest surprise in the engine, and the `STRICT` tables that fix it. You will configure WAL mode and measure what it does to concurrent readers. You will build full-text search with FTS5, recover a corrupted database, and reason about the mobile lifecycle - where your process is killed without warning mid-transaction, routinely, by design.
Seven modules, about 65 hours including laboratory work. Every module carries a worked example and an assessed laboratory. The capstone is an offline mobile expense tracker with migrations, full-text search and a tested backup and restore.
Introduction
You need the `sqlite3` command-line tool, version 3.37 or newer - `STRICT` tables arrived in 3.37 and the course uses them from Module 1. Check with `sqlite3 --version`, because system packages lag: macOS ships an old build, and several Linux distributions do too. If yours is behind, download the precompiled binary from sqlite.org rather than fighting the package manager.
One expectation to set early. Much of what you know about operating a database does not apply here, and some of it is actively wrong. There is no `GRANT`. There is no connection pool. There is no "the database server is down", because there is no server - but there is "the file is on a network share and now it is corrupt", which is worse and is covered in Module 5. Read the modules for what SQLite does rather than for the analogue of what PostgreSQL does.
What you will be able to do
- Explain SQLite's embedded architecture and say when it is and is not the right choice
- Predict what type affinity will do to a value, and prevent it with STRICT tables
- Configure the PRAGMA settings that matter, and say what each one trades
- Design a schema with enforced constraints, including the foreign keys SQLite disables by default
- Choose between the rollback journal and WAL, and measure the difference under concurrent readers
- Handle SQLITE_BUSY correctly rather than by retrying blindly
- Read EXPLAIN QUERY PLAN and build a covering index from what it tells you
- Implement full-text search with FTS5, including ranking and highlighting
- Query and index JSON stored in a column
- Back up a live database safely, verify integrity, and recover from corruption
- Reason about the mobile lifecycle, WAL checkpointing and migration testing
- Produce a deployment checklist for an embedded database, including its encryption options
What each level covers
5 levels · 7 lessons
-
Beginner - Foundations
The architecture that makes SQLite different, the type system that will surprise you, and schema design with constraints that actually hold.
2 lessons 14 min of reading
Start with Embedded Architecture and Type Affinity → -
Intermediate - Application Behaviour
One writer, many readers, and the locking behaviour your application must be written around.
1 lesson 6 min of reading
Start with Transactions, WAL and Single-Writer Concurrency → -
Advanced - Performance and Reliability
Making it fast on evidence, adding real search, and getting the data back when the file is damaged.
2 lessons 11 min of reading
Start with Performance Engineering, FTS5 and JSON → -
Expert - Security and Production Architecture
The security model when there is no server, and shipping an embedded database to devices you do not control.
1 lesson 7 min of reading
Start with Security, Encryption and the Mobile Lifecycle → -
Capstone
One shippable system: offline-first, migrated, searchable, and recoverable.
1 lesson 5 min of reading
Start with Capstone - An Offline Expense Tracker →
Guides and articles
Longer reading about this subject, written alongside the course.
Before you start
- sqlite3 command-line tool, version 3.37 or newer
- One programming language with a SQLite binding
- A disposable working directory
- Introductory SQL before Module 2
- The programme's shared foundations
Common questions
- What does the SQLite: Embedded Databases Done Properly course cover?
- It is 5 levels and 7 lessons: Beginner - Foundations; Intermediate - Application Behaviour; Advanced - Performance and Reliability; Expert - Security and Production Architecture; Capstone. Each level ends with a quiz, and the last one is an exam over the whole course.
- How long does it take?
- About 43 minutes of reading and exercises - roughly 0.7 hours. It is self-paced with no cohort and no start date, so you can leave and come back and the site remembers where you were.
- What do I need to know first?
- sqlite3 command-line tool, version 3.37 or newer. One programming language with a SQLite binding. A disposable working directory. Introductory SQL before Module 2. The programme's shared foundations.
- Is it free?
- Yes. Every lesson, example and quiz in this course is free to read, and you do not need an account to read them. Signing in only adds progress tracking and quiz results.
- What will I be able to do afterwards?
- Explain SQLite's embedded architecture and say when it is and is not the right choice. Predict what type affinity will do to a value, and prevent it with STRICT tables. Configure the PRAGMA settings that matter, and say what each one trades. Design a schema with enforced constraints, including the foreign keys SQLite disables by default. Choose between the rollback journal and WAL, and measure the difference under concurrent readers. Handle SQLITE_BUSY correctly rather than by retrying blindly. Read EXPLAIN QUERY PLAN and build a covering index from what it tells you. Implement full-text search with FTS5, including ranking and highlighting. Query and index JSON stored in a column. Back up a live database safely, verify integrity, and recover from corruption. Reason about the mobile lifecycle, WAL checkpointing and migration testing. Produce a deployment checklist for an embedded database, including its encryption options.