DB2: How to Empty a Table
There are two ways to clear the data of a table.
- Use the DELETE statement:
DELETE FROM 表名;
This statement will delete all data in the table while preserving the table structure and constraints.
- Use the TRUNCATE statement:
TRUNCATE TABLE 表名;
This statement will quickly delete all data in the table, reset the auto-increment counter, and cannot be rolled back.