当前位置:网站首页>MySQL删除表后如何使ID从1开始
MySQL删除表后如何使ID从1开始
2022-06-27 20:25:00 【bksheng】
方法一:
# 删除
delete from 表名;
#设置成从1开始自增
ALTER TABLE 表名 AUTO_INCREMENT=1;
方法二:
#删除之前先执行删除外键约束
SET foreign_key_checks = 0;
#将数据全部删除,重新定位自增的字段
truncate table 表名;
#删除完之后再执行启动外键约束
SET foreign_key_checks = 1;
边栏推荐
- SQL Server 2016详细安装教程(附注册码和资源)
- 基于 ESXi 的黑群晖 DSM 7.0.1 安装 VMware Tools
- PE买下一家内衣公司
- Go language slice vs array panic: runtime error: index out of range problem solving
- Gartner focuses on low code development in China how UNIPRO practices "differentiation"
- 「R」使用ggpolar绘制生存关联网络图
- Stunned! The original drawing function of markdown is so powerful!
- 华为伙伴暨开发者大会2022 | 麒麟软件携手华为共建计算产业,共创数智未来
- Mysql database experiment report (I)
- average-population-of-each-continent
猜你喜欢

Oracle obtains the beginning and end of the month time, and obtains the beginning and end of the previous month time

Livox lidar+apx15 real-time high-precision radar map reproduction and sorting

Is the dog virtue training with a monthly salary of 30000 a good business?

本机部署一个MongoDB单节点服务器,并启用auth验证、开启oplog

average-population-of-each-continent

DCC888 :Register Allocation

Livox Lidar+海康Camera 基于loam的实时三维重建生成RGB彩色点云

月薪3万的狗德培训,是不是一门好生意?

Crawler notes (3) -selenium and requests

【经典干货书】数据科学中的信息理论方法,561页pdf
随机推荐
Crawler notes (1) - urllib
What problems should be paid attention to in the serpentine wiring of PCB?
医美大刀,砍向00后
向量召回和字面召回的选择与权衡
Using xgboost with tidymodels
[js]var, let, const
netERR_ CONNECTION_ Refused solution
Transformation from student to engineer
Advertising is too "wild", Yoshino "surrenders"
Re recognize G1 garbage collector through G1 GC log
Workflow automation low code is the key
Azure Kinect DK realizes 3D reconstruction (PC non real time version)
「R」使用ggpolar绘制生存关联网络图
Bibliothèque d'exploitation / de développement locale open source pour l'outil de dessin en ligne hiplot
Follow the archiving tutorial to learn rnaseq analysis (III): count standardization using deseq2
[cloud based co creation] what is informatization? What is digitalization? What are the connections and differences between the two?
Spark bug Practice (including bug: classcastexception; connectexception; noclassdeffounderror; runtimeexceptio, etc.)
跟着存档教程动手学RNAseq分析(二)
Personal tree ALV template - accelerate your development
OData - API using SAP API hub in SAP S4 op