当前位置:网站首页>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
边栏推荐
- 数据库文件中的未分配的块和未使用的块的区别
- Addition and Subtraction of Scores in LeetCode Medium Questions
- 分布式系统架构需要解决的问题
- addressable in Golang
- 【Exception】The field file exceeds its maximum permitted size of 1048576 bytes.
- errno错误码及含义(中文)
- els 方块向右移动边界判断、向下加速
- Difference between unallocated blocks and unused blocks in database files
- Bubble sort, selection sort, insertion sort, binary search directly
- 想从手工测试转岗自动化测试,需要学习哪些技能?
猜你喜欢
[Dynamic programming] Maximum sum of consecutive subarrays
Mysql 45 study notes (twenty-five) MYSQL guarantees high availability
Problems that need to be solved in distributed system architecture
A brief introduction to the CheckBox component of the basic components of Flutter
浅识Flutter 基本组件之CheckboxListTile组件
"A daily practice, happy water problem" 1331. Array serial number conversion
Postgresql 15 source code analysis (5) - pg_control
Daily practice of LeetCode - 138. Copy a linked list with random pointers
大小端模式
7年经验,功能测试工程师该如何一步步提升自己的能力呢?
随机推荐
【论文阅读】Mastering the game of Go with deep neural networks and tree search
Redis counts new and retained users
Day32 LeetCode
进程间通信
浅识Flutter 基本组件之CheckBox组件
7年经验,功能测试工程师该如何一步步提升自己的能力呢?
LocalDate addition and subtraction operations and comparison size
The Map Entry understanding and application
No qualifying bean of type 问题
Key Technologies of Interface Testing
顺序表的实现
[Swift]自定义点击APP图标弹出的快捷方式
MultipartFile file upload
some of my own thoughts
The use of beforeDestroy and destroyed
Automation strategies for legacy systems
errno error code and meaning (Chinese)
C# remote debugging
type_traits元编程库学习
WebSocket Session is null