In SQLite, an AUTOINCREMENT
column is one that uses an automatically incremented value for each row that’s inserted into the table.
There are a couple of ways you can create an AUTOINCREMENT
column:
- You can create it implicitly when you define the column as
INTEGER PRIMARY KEY
. - You can create it explicitly with the
AUTOINCREMENT
keyword. One downside of this method is that it uses extra CPU, memory, disk space, and disk I/O overhead.
Both methods cause the column to use an incrementing value each time a new row is inserted with NULL
in that column.
However, there are some subtle differences between how each method works.
Continue reading →