On this page
  1. Architecture & Type Affinity
  2. Contents
  3. Single-File Embedded Architecture
  4. Dynamic Typing & STRICT Tables
  5. INTEGER PRIMARY KEY & WITHOUT ROWID

Architecture & Type Affinity

Prev: sqlite3 | Up: sqlite3 | Next: WAL Mode & PRAGMA Tuning
Rel: python3 sqlite3, DDL & Constraints
Ref: SQLite — Datatypes In SQLite
Tags: #public #databases #sqlite3 #sql


Contents


Single-File Embedded Architecture

SQLite runs in-process with zero server daemon and stores the entire database (tables, indexes, triggers, views) in a single cross-platform file. It is ideal for local apps, CLIs, mobile apps, edge services, and read-heavy single-node web services.


Dynamic Typing & STRICT Tables

By default, SQLite uses dynamic typing with 5 storage classes (NULL, INTEGER, REAL, TEXT, BLOB) and column type affinity rather than rigid enforcement. Add STRICT (SQLite 3.37+) to enforce declared types (INT, INTEGER, REAL, TEXT, BLOB, ANY):

CREATE TABLE products (
  id          INTEGER PRIMARY KEY,
  sku         TEXT NOT NULL UNIQUE,
  price_cents INTEGER NOT NULL CHECK (price_cents >= 0)
) STRICT;

INTEGER PRIMARY KEY & WITHOUT ROWID

Linked from

Related notes