SQLite Reset Primary Key Field
回答1
Try this:
delete from your_table;
delete from sqlite_sequence where name='your_table';
SQLite keeps track of the largest ROWID that a table has ever held using the special
SQLITE_SEQUENCE
table. TheSQLITE_SEQUENCE
table is created and initialized automatically whenever a normal table that contains an AUTOINCREMENT column is created. The content of the SQLITE_SEQUENCE table can be modified using ordinary UPDATE, INSERT, and DELETE statements. But making modifications to this table will likely perturb the AUTOINCREMENT key generation algorithm. Make sure you know what you are doing before you undertake such changes.
回答2
You can reset by update sequence after deleted rows in your-table
UPDATE SQLITE_SEQUENCE SET SEQ=0 WHERE NAME='table_name';
delete from goods_goodscategory
where id>6
select * from sqlite_sequence
update sqlite_sequence
set seq=6
where name='goods_goodscategory'
标签:Reset,SQLite,sequence,SEQUENCE,SQLITE,sqlite,Field,table From: https://www.cnblogs.com/chucklu/p/17347306.html