Search notes:

SQLite: autoincrement

autoincrement columns are only allowed on integer primary key columns.

autoincrement rowids are not reused

The following example tries to demonstrate that autoincrement rowids are not reused:
create table T (p integer primary key              , d);
create table U (p integer primary key autoincrement, d);

insert into T (d) values ('first');
insert into U (d) values ('first');

insert into T (d) values ('second');
insert into U (d) values ('second');

delete from T where d = 'second';
delete from U where d = 'second';

insert into T (d) values ('third');
insert into U (d) values ('third');

.mode  column
.width 2 10

select * from T;
--
--  1   first
--  2   third

select * from U;
--
--  1   first
--  3   third
Github repository about-SQLite, path: /tables/constraints/primary-key/autoincrement/vs-rowid.sql

See also

The maximum used autoincrement value per table is stored in the schema object sqlite_sequence.

Index

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 8 attempt to write a readonly database in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php:78 Stack trace: #0 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(78): PDOStatement->execute(Array) #1 /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php(30): insert_webrequest_('/notes/developm...', 1759413155, '216.73.216.42', 'Mozilla/5.0 App...', NULL) #2 /home/httpd/vhosts/renenyffenegger.ch/httpsdocs/notes/development/databases/SQLite/tables/constraints/primary-key/autoincrement/index(72): insert_webrequest() #3 {main} thrown in /home/httpd/vhosts/renenyffenegger.ch/php/web-request-database.php on line 78