Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Statements for emptying table data in mysql database

2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The mysql empty table data command has the following two statements:

Statement 1:

Delete from table name

Statement 2:

Truncate table table name

Compare:

(1) the delete statement without the where parameter can delete all the contents of the mysql table, and use truncate table to empty all the contents of the mysql table.

(2) truncate is faster than delete in efficiency, but mysql logs are not recorded after truncate deletion, and data cannot be recovered.

(3) the effect of delete is a bit like deleting all the records in the mysql table to the end, while truncate is equivalent to retaining the structure of the mysql table and recreating the table, and all the states are equivalent to the new table.

What is the above command for mysql to clear the table data? For more details, please pay attention to other related articles!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report