In SQLite, there is no But this method cannot return the increment to zero. If you want to return the increment to zero, you can use the following methods: When Hypothetical The following is an example of deleting the record in the above table: Now, the records in the
TRUNCATE
TABLE
Command, but you can use the
SQLite
Of DELETE Command to delete all data from an existing table. 1.38.1. Grammar ¶
DELETE
The basic syntax of the command is as follows:sqlite> DELETE FROM table_name;
sqlite> DELETE FROM sqlite_sequence WHERE name = 'table_name';
SQLite
When a self-incrementing column is included in the database, a file named
sqlite_sequence
Donovan’s watch. This table contains two columns:
name
and
seq
.
name
records the table in which the increment column is located, and
seq
records the current serial number (the number of the next record is the current serial number plus 1). If you want to zero the sequence number of a self-incrementing column, you only need to modify
sqlite_sequence
A watch will be fine.UPDATE sqlite_sequence SET seq = 0 WHERE name = 'table_name';
1.38.2. Example ¶
COMPANY
The table has the following records:ID NAME AGE ADDRESS SALARY
---------- ---------- ---------- ---------- ----------
1 Paul 32 California 20000.0
2 Allen 25 Texas 15000.0
3 Teddy 23 Norway 20000.0
4 Mark 25 Rich-Mond 65000.0
5 David 27 Texas 85000.0
6 Kim 22 South-Hall 45000.0
7 James 24 Houston 10000.0
SQLite> DELETE FROM sqlite_sequence WHERE name = 'COMPANY';
SQLite> VACUUM;
COMPANY
table are completely deleted, using the
SELECT
Statement will have no output.