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
In the previous article, we introduced three comm...
Responsive layout systems are already very common...
SQL Left Join, Right Join, Inner Join, and Natura...
1. First go to the official website https://www.p...
Preface The mv command is the abbreviation of mov...
This article shares the specific code of uni-app ...
Table of contents 1. Index Basics 1. Types of Ind...
For example, there is an input box <el-input r...
1. Resume nacos database Database name nacos_conf...
View the dependent libraries of so or executable ...
Build a simulation environment: Operating system:...
This article is translated from the blog Usability...
Scenario: A laradock development environment (php...
Related system calls for file operations create i...
Table of contents 1. Basic Concepts of GTID 2. GT...