sqlite
Database; use; embedded relational database
truncate
英[tr???ke?t] US[?tr??ke?t ]
vt. Shorten
table
English [?te?bl] US [?teb?l]
n. Table; table, directory ; operating table, workbench, game table; flat floor
vt. tabulation; shelving; fitting; shelving
adj.table
SQLite Truncate Table instruction syntax
Function:In SQLite, there is no TRUNCATE TABLE command, but you can use SQLite's DELETE command to delete all data from an existing table, but it is recommended to use the DROP TABLE command to delete the entire table, and then Create it again.
Syntax: The basic syntax of the DELETE command is as follows:
sqlite> DELETE FROM table_name;
SQLite Truncate Table instruction example
假設(shè) COMPANY 表有如下記錄: 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 COMPANY; SQLite> VACUUM; 現(xiàn)在,COMPANY 表中的記錄完全被刪除,使用 SELECT 語句將沒有任何輸出。