drop table Drop directly deletes table information, which is the fastest, but data cannot be retrieved For example, to delete the user table: drop table user; truncate (table) truncate deletes table data but not its structure. It ranks second in speed but cannot be used with where. For example, to delete the user table: truncate table user; delete from delete deletes the data in the table without deleting the table structure. It is the slowest, but can be used with where to delete the specified rows. For example, delete all data in the user table delete from user; Delete the specified record in the user table delete from user where user_id = 1; The difference between the three methods Similarities
Differences
Quick Facts Difference between delete and delete from If you only delete one table, the effect is the same; if you need to join other tables, you need to use from delete tb1 from tb1 m where id in (select id from tb2); Usage Summary
This concludes this article about three ways to delete a table in MySQL (summary). For more information about deleting a table in MySQL, please search for previous articles on 123WORDPRESS.COM or continue browsing the following related articles. I hope you will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Analysis of Nginx Rewrite usage scenarios and configuration methods
>>: Summary of 28 common JavaScript string methods and usage tips
Problem description: After executing docker run -...
Table of contents 1. First look at COUNT 2. The d...
Table of contents 1 View the current database con...
Preface This article mainly introduces the releva...
aforementioned This article is very short~ The ma...
In the previous article, we talked about MySQL tr...
Introduction Part 1: Written at the beginning One...
The specific code is as follows: <a href="...
XQuery is a language for extracting data from XML...
First, pull the image (or just create a container...
Problem Description In the framework of Ele.me UI...
1. Check the maximum number of open files in the ...
The previous article wrote about how to manually ...
The attributes of the <TD> tag are used to ...
1. Perform file name search which (search for ...