当前位置:网站首页>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;
边栏推荐
- ABAP essay - material master data interface enhancement - tab enhancement
- 使用SQL进行数据去重的N种方法
- Hiplot 在线绘图工具的本地运行/开发库开源
- Redis principle - string
- Azure Kinect DK realizes 3D reconstruction (PC non real time version)
- 跟着存档教程动手学RNAseq分析(三):使用DESeq2进行计数标准化
- 这类人开始被VC疯抢,月薪8万
- 广告太「野」,吉野家「渡劫」
- [js]var, let,const 的区别
- OData - SAP S4 OP 中使用SAP API Hub 的API
猜你喜欢

Design of STM32 and rc522 simple bus card system

Character interception triplets of data warehouse: substrb, substr, substring

Infiltration learning - problems encountered during SQL injection - explanation of sort=left (version(), 1) - understanding of order by followed by string

Structured machine learning project (II) - machine learning strategy (2)

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

Introduce you to ldbc SNB, a powerful tool for database performance and scenario testing

Crawler notes (2) - parse

Mysql database experiment report (I)

Passerelle de service pour les microservices

Livox Lidar+海康Camera实时生成彩色点云
随机推荐
One to many association in MySQL to obtain the latest data in multiple tables
Penetration learning - shooting range chapter - detailed introduction to Pikachu shooting range (under continuous update - currently only the SQL injection part is updated)
Process judgment - ternary operation - for loop
Service gateway of microservices
Basic data type and complex data type
Livox Lidar+海康Camera 基于loam的实时三维重建生成RGB彩色点云
Azure Kinect DK 实现三维重建 (jetson实时版)
Structured machine learning project (I) - machine learning strategy
微服务之服务网关
Go语言fsnotify接口实现监测文件修改
Spark BUG實踐(包含的BUG:ClassCastException;ConnectException;NoClassDefFoundError;RuntimeExceptio等。。。。)
Day 7 of "learning to go concurrent programming in 7 days" go language concurrent programming atomic atomic actual operation includes ABA problem
用pytorch进行CIFAR-10数据集分类
OData - API using SAP API hub in SAP S4 op
广告太「野」,吉野家「渡劫」
消除el-image图片周围间隙
这类人开始被VC疯抢,月薪8万
SQL Server 2016详细安装教程(附注册码和资源)
「R」使用ggpolar绘制生存关联网络图
月薪3万的狗德培训,是不是一门好生意?