如何清空表格

时间:2013-05-19 08:05:49

标签: sql sqlite

如何在SQLite中清空表格?

如果我执行“DELETE * FROM TABLENAME WHERE ID> 0”,则下次输入记录时ID不会从1开始。

3 个答案:

答案 0 :(得分:1)

要真正消除表格的所有痕迹,您必须删除它然后重新创建它。如果您特别担心AUTOINCREMENT列,则可以操纵the sqlite_sequence table进行重置。

答案 1 :(得分:1)

DELETE FROM tablename;

DELETE FROM SQLITE_SEQUENCE WHERE name ='tablename';

答案 2 :(得分:1)

DELETE FROM SQLITE_SEQUENCE WHERE NAME = 'TABLENAME'