当前位置:网站首页>Several delete operations in SQL

Several delete operations in SQL

2022-06-26 18:12:00 yanruo06280

sql Usage and differences of several deletion operations in

1、delete sentence
Delete Delete table data , Keep the table structure , And can add where, Delete one or more lines .
The process of deleting is to delete a row from the table one at a time , At the same time, the delete operation of the row is saved as a transaction record in the log for rollback operation

delete from  Table name  where codition

2、Truncate Delete table data , Keep the table structure , Can't add where,
Deleting all data from the table at one time does not record the individual deletion operation records in the log , Deleting a line is not recoverable . And the delete trigger related to the table will not be activated during the deletion process . Fast execution .TRUNCATE Only right TABLE;DELETE It can be table and view

truncate table  Table name 

Clearing speed ,truncate Than delete faster

3、Drop It's completely deleted , Including table structure

drop table  Table name 
原网站

版权声明
本文为[yanruo06280]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/177/202206261806550602.html