当前位置:网站首页>mysql — 清空表中数据
mysql — 清空表中数据
2022-06-29 17:53:00 【全栈程序员站长】
mysql – 清空表中数据
删除表信息的方式有两种 :
truncate table table_name;
delete * from table_name;注 : truncate操作中的table可以省略,delete操作中的*可以省略
- truncate、delete 清空表数据的区别 :
1> truncate 是整体删除 (速度较快),delete是逐条删除 (速度较慢) 2> truncate 不写服务器 log,delete 写服务器 log,也就是 truncate 效率比 delete高的原因 3> truncate 不激活trigger (触发器),但是会重置Identity (标识列、自增字段),相当于自增列会被置为初始值,又重新从1开始记录,而不是接着原来的 ID数。而 delete 删除以后,identity 依旧是接着被删除的最近的那一条记录ID加1后进行记录。如果只需删除表中的部分记录,只能使用 DELETE语句配合 where条件
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/101829.html原文链接:https://javaforall.cn
边栏推荐
- Servlet学生管理系统(萌新练手版)
- Shell tutorial circular statements for, while, until usage
- phpunit骚操作之静态类的部分mock
- 3H proficient in opencv (VI) - image stacking
- Niuke small Bai monthly race 52 D ring insectivorous (feet +st table)
- Workflow module jar package startup error: liquibase – waiting for changelog lock
- Digital twin energy system, creating a "perspective" in the low-carbon era
- 工作流模块Jar包启动报错:liquibase – Waiting for changelog lock….
- [wangdingbei 2020 Qinglong formation]areuserialz
- kubekey2.2.1 kubernetes1.23.7离线包制作+harbor部暑并上传镜像
猜你喜欢

Adobe Premiere基础-批量素材导入序列-变速和倒放(回忆)-连续动作镜头切换-字幕要求(十三)

Issue 42: is it necessary for MySQL to have multiple column partitions

Automatic software test - read SMS verification code using SMS transponder and selenium

Professor of Cambridge University: eating breakfast often is harmful and dangerous. - you know what

Configure the local domain name through the hosts file

Force deduction daily question 06.29 add two numbers

Parental delegation mechanism
![[webdriver] upload files using AutoIT](/img/69/8c27626d515976b47f1df4831d09c8.png)
[webdriver] upload files using AutoIT

Let Google search your blog

Software testing - you may not understand the basic theoretical knowledge
随机推荐
Xiaomai technology x hologres: high availability of real-time data warehouse construction of ten billion level advertising
等保测评结论为差,是不是表示等保工作白做了?
Analyze the implementation principle of zero copy mechanism, applicable scenarios and code implementation
3H proficient in opencv (VIII) - shape detection
shell教程之循环语句for,while,until用法
Adobe Premiere基础-不透明度(混合模式)(十二)
Relationship among controller, service and Dao
Test dble split function execution + import time-consuming shell script reference
Adobe Premiere基础-常用的视频特效(边角定位,马赛克,模糊,锐化,手写工具,效果控件层级顺序)(十六)
Jar包后台启动并输出日志
DevCloud加持下的青软,让教育“智”上云端
软件测试——基础理论知识你都不一定看得懂
Proxmox VE Install 7.2
双亲委派机制
Image feature computation and representation -- content based image retrieval
测试dble split功能执行+导入耗时shell脚本参考
phpunit骚操作之静态类的部分mock
Kubekey2.2.1 kubernetes1.23.7 offline package production +harbor Department summer and upload image
kubekey2.2.1 kubernetes1.23.7离线包制作+harbor部暑并上传镜像
Shell tutorial circular statements for, while, until usage