当前位置:网站首页>Regarding the primary key id in the mysql8.0 database, when the id is inserted using replace to be 0, the actual id is automatically incremented after insertion, resulting in the solution to the repea
Regarding the primary key id in the mysql8.0 database, when the id is inserted using replace to be 0, the actual id is automatically incremented after insertion, resulting in the solution to the repea
2022-07-31 03:37:00 【Changsha Red Fatty Qt】
If this article is an original article, please indicate the source of the original text for reprinting
The blog address of this article: https://hpzwl.blog.csdn.net/article/details/126074729
Database related development
Requirements
The configuration file is stored. Sometimes the database does not initialize a piece of data. All you want to use is the method of updating if there is data, and inserting if there is no data.
Question
In the actual debugging process, when it is found that the id is 0, each time the record with the id of 0 is replaced, the id will be incremented automatically, as shown below:
Table data structure definition and manipulation
Solution 1: Modify the id value, the id value cannot be 0
Change the stored id value to 1. The verification cannot be 0. If it is 0, it will automatically add a new piece of data.
Solution 2: Modify the table structure and change the id to not increase automatically
If this article is an original article, please indicate the source of the original text for reprinting
The blog address of this article: https://hpzwl.blog.csdn.net/article/details/126074729
边栏推荐
- Getting Started with CefSharp - winform
- How to develop a high-quality test case?
- Port inspection steps - 7680 port analysis - Dosvc service
- Redis counts new and retained users
- Several common errors when using MP
- False positives and false negatives in testing are equally worthy of repeated corrections
- 3.5 】 【 Cocos Creator slow operating system to stop all animations
- Daily practice of LeetCode - palindrome structure of OR36 linked list
- Redis 使用 sorted set 做最新评论缓存
- Just debuted "Fight to Fame", safety and comfort are not lost
猜你喜欢
A brief introduction to the CheckboxListTile component of the basic components of Flutter
[Compilation principle] Design principle and implementation of recursive descent parsing
IDEA comment report red solution
Key Technologies of Interface Testing
C语言从入门到如土——数据的存储
Detailed explanation of TCP and UDP
5. How does the SAP ABAP OData service support the $filter operation
STM32 problem collection
LocalDate加减操作及比较大小
Several common errors when using MP
随机推荐
web容器及IIS --- 中间件渗透方法1
The use of beforeDestroy and destroyed
[Compilation principle] Design principle and implementation of recursive descent parsing
"DeepJIT: An End-To-End Deep Learning Framework for Just-In-Time Defect Prediction" paper notes
ClickHouse:设置远程连接
Atomic operation CAS
「 每日一练,快乐水题 」1331. 数组序号转换
els block to the right
(四)递归、可变参数、访问修饰符、理解 main 方法、代码块
Distributed locks and three implementation methods
顺序表的实现
下载jar包的好地方
[C language] General method of expression evaluation
LocalDate加减操作及比较大小
LocalDate addition and subtraction operations and comparison size
Point Cloud DBSCAN Clustering (MATLAB, not built-in function)
The distance value between two arrays of LeetCode simple questions
进程间通信
【CocosCreator 3.5】CocosCreator get network status
errno错误码及含义(中文)