SQLite
SQLite is a small relational database stored in a single file.
What Is SQLite
SQLite does not require a separate database server. The application reads and writes directly to a database file.
It is useful for local apps, prototypes, mobile apps, tests, embedded systems, and small production workloads.
How To Use SQLite
Install the SQLite command-line tool or use a language library. Create a .db file and run SQL statements against it.
Basic Example
CREATE TABLE notes (
id integer PRIMARY KEY AUTOINCREMENT,
title text NOT NULL,
body text NOT NULL
);
INSERT INTO notes (title, body)
VALUES ('First note', 'SQLite is simple to start with.');
SELECT title FROM notes;
Common Concepts
- The database is stored in one file.
- SQL is used for tables and queries.
- It is serverless and lightweight.
- It works well for local-first data.
What To Learn Next
Learn file-based storage, migrations, indexes, transactions, full-text search, and when to move to a client-server database.