当前位置:网站首页>sql中的几种删除操作
sql中的几种删除操作
2022-06-26 18:07:00 【yanruo06280】
sql中的几种删除操作用法与区别
1、delete语句
Delete删除表数据,保留表结构,且可以加where,删除一行或多行。
执行删除的过程是每次从表中删除一行,并且同时将该行的删除操作作为事务记录在日志中保存以便进行进行回滚操作
delete from 表名 where codition
2、Truncate删除表数据,保留表结构,不可以加where,
一次性地从表中删除所有的数据并不把单独的删除操作记录记入日志保存,删除行是不能恢复的。并且在删除的过程中不会激活与表有关的删除触发器。执行速度快。TRUNCATE 只能对TABLE;DELETE可以是table和view
truncate table 表名
清除速度方面,truncate比delete更快
3、Drop是完全删除,包括表结构
drop table 表名
边栏推荐
猜你喜欢
随机推荐
Decision tree and random forest
判断某个序列是否为栈的弹出序列
LeetCode——226. 翻轉二叉樹(BFS)
Row lock analysis and deadlock
Idea collection code, quickly open favorites collection window
背包问题求方案数
How about opening an account at Guojin securities? Is it safe?
JVM entry door (1)
tag动态规划-刷题预备知识-2. 0-1背包理论基础和二维数组解法模板
Introduction to Ethereum Technology Architecture
Handwritten promise all
pycharm的plt.show()如何保持不关闭
in和exsits、count(*)查询优化
Dos et détails de la méthode d'attaque
MYSQL的下载与配置 mysql远程操控
必须要掌握的面试重点——索引和事务(附讲B-树与B+树)
Detailed explanation of asymmetric cryptosystem
How does Guosen Securities open an account? Is it safe to open a stock account through the link
Let torch cuda. is_ Experience of available() changing from false to true
二分查找-2









