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

What is the MySQL TRUNCATE command used for?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2023-08-23 09:41:03
forward
937 people have browsed it

MySQL TRUNCATE命令用于什么?

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

Syntax

Truncate table table_name;
Copy after login

Example

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

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)
Copy after login

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 of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template