I had some records inside my table "users", then I deleted all records (SQL -DELETE FROM "users" WHERE ("cash" = 10000)). And now, when I add a new record (a new user) the id count continues to grow, but it does not start from the beginning.

13 Ruslan 10000 (because previously I added 12 records and deleted)

Is it possible to start id count again from 1?

1 Ruslan 10000

How to start id count from 1 after deleting all records in the table?

Thanks ;)


The autoincrement keys are in a table called sqlite_sequence. I do not see a way to access that table through the phpliteadmin GUI, but it can be accessed from the SQL tab (or with sqlite3). It has two columns, name which is table name and seq which is the last sequence assigned. After you delete all the records in the users table you could update sqlite_sequence set seq = 0 where name = 'users'. The next key it assigns will be 1.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .