DB2: How to Empty a Table

There are two ways to clear the data of a table.

  1. Use the DELETE statement:
DELETE FROM 表名;

This statement will delete all data in the table while preserving the table structure and constraints.

  1. 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.

bannerAds