Schema and data

rowid and INTEGER PRIMARY KEY

Understand the special relationship between an INTEGER PRIMARY KEY column and SQLite’s internal row identifier.

8 minute lesson

~~~

Most SQLite tables have an internal integer rowid.

A column declared exactly as INTEGER PRIMARY KEY becomes an alias for that rowid. SQLite assigns the next available value when an insert omits the column.

You normally do not need AUTOINCREMENT. It changes reuse rules and adds overhead; use it only when old identifiers must never appear again.

Lesson completed

Take this course offline

Get every free book and course as PDF and EPUB files.

Get the download library →