H2 Database - Truncation

H2 Database - Truncation

TRUNCATE is a command used to remove data from a table. Unlike DELETE FROM without a WHERE clause, this command cannot be rolled back. This command commits an open transaction on this connection.

Syntax

Following is the general syntax of the truncate command.

TRUNCATE TABLE tableName 

example

In this example, we will truncate a table named test with the following query.

TRUNCATE TABLE test;

The above query results in the following output.