Primary keys
A primary key uniquely identifies a row.
What it is
A primary key uniquely identifies a row.
When to use it
Use stable identifiers independent of mutable business data.
Syntax
id INTEGER PRIMARY KEYExample
CREATE TABLE users (
id INTEGER PRIMARY KEY,
email TEXT NOT NULL UNIQUE,
name TEXT NOT NULL
);Common mistakes
SQLite INTEGER PRIMARY KEY is special; do not assume its auto-increment behavior transfers to all engines.