Home >Database >Mysql Tutorial >What is the MySQL TRUNCATE command used for?

What is the MySQL TRUNCATE command used for?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBforward
2023-08-23 09:41:03942browse

MySQL TRUNCATE命令用于什么?

As its name suggests, it is used to delete all records from a MySQL table.

Syntax

Truncate table table_name;

Example

mysql> Truncate table student;
Query OK, 0 rows affected (0.18 sec)

The above query deletes all records from the ‘Student’ table. We can observe that MySQL returned the empty set after running the following query:

mysql> select * from student;
Empty set (0.00 sec)

The above is the detailed content of What is the MySQL TRUNCATE command used for?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete