TRUNCATE

Overview

Removes all rows from the specified table.

See also: SQL Statements for MariaDB Xpand 6.1, in 6.0, and in 5.3

USAGE

Common Syntax:

TRUNCATE [TABLE] <tbl_name> [, <tbl_name> ...]

DETAILS

PRIVILEGES

To execute TRUNCATE, the user must have either the DROP or TRUNCATE privilege.

EXAMPLES

TRUNCATE

To drop a table and re-create it with the same definition, specify the table name:

TRUNCATE customers;

The following statement is equivalent:

TRUNCATE TABLE customers;

TRUNCATE Multiple Tables

To drop and re-create multiple tables, specify the table names separated by commas:

TRUNCATE TABLE customers, invoices;

CHANGE HISTORY

Release Series

History

6.1

  • Present starting in MariaDB Xpand 6.1.0.

6.0

  • Present starting in MariaDB Xpand 6.0.3.

5.3

  • Present starting in MariaDB Xpand 5.3.13.