Updated on 2022-12-07 GMT+08:00

Clearing Data

Function

This statement is used to delete data from the table.

Syntax

1
TRUNCATE TABLE tablename [PARTITION (partcol1=val1, partcol2=val2 ...)];

Keyword

Table 1 Parameter

Parameter

Description

tablename

Name of the target table that runs the Truncate statement.

partcol1

Partition name of the table to be deleted.

Precautions

Only data in the table can be deleted.

Example

1
truncate table test PARTITION (class = 'test');