Want to know difference between truncate and drop in mysql? we have a huge selection of difference between truncate and drop in mysql information on alibabacloud.com
The difference between drop, truncate, and delete in MySQL(1) The DELETE statement performs the deletion by deleting one row from the table at a time and saving the row's delete operation as a transaction record in the log for the rollback operation.
Note: Delete In this case refers to the DELETE statement without a WHERE clausesame Pointtruncate and delete without a WHERE clause, and drop deletes the data in the tabledifferent points:1. Truncate and delete only delete data without deleting the
The instance understands the difference between truncate and delete in SQL, sqltruncate
This article uses a simple example to introduce the differences between truncate and delete in SQL. The specific content is as follows:
--- Create table
Deletetruncatedrop difference bitsCN.com
Differences between Delete/truncate/drop
1. delete/truncate: only delete data. The index structure is not deleted. Drop will delete the table structure and the index/constrain/trigger that depends on the
Delete, Truncate, drop analysis for MySQLSame point:Truncate and delete without a WHERE clause, and drop deletes the data in the tableDifferent points1. Truncate and delete only delete data without deleting the structure of the table (definition)The
You need to understand the Delete statement of MySQL. MySQL provides the delete and truncate statements to delete data.Definition of the delete statement:Most of the children who often deal with databases use delete statements to delete data. Now
Different points:
1. Truncate and delete Delete only the data do not delete the structure of the table (definition)
The DROP statement deletes the table's structure-dependent constraints (constrain), triggers (trigger), indexes (index); That depends
1. Delete:delete from table_name; or delete from table_name where column =?;Delete the data in the table, but do not delete the table structure , delete the time is a row of deleted, less efficient, can be used to delete a single data.2.
The TRUNCATE command clears all records in the Table in mysql and resets the table ID. Next I will introduce the usage and instance of TRUNCATE.
Truncate table deletes all rows in the TABLE, but does not record the deletion of a single
Usage:1. DROP table TBDrop will delete the table directly, there is no way to retrieve2, truncate (table) TBDelete all data in a table and cannot be used with where3. Delete from TB (where)Delete data from a table (you can make a row)The difference
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.