游客发表

MySQL插入处理重复键值的2种不同处理方案

发帖时间:2025-11-05 06:59:43

MySQL插入处理重复键值的2种不同处理方案
复制MySQL> create table test1(id int,入处name varchar(5),type int,primary key(id));    Query OK, 0 rows affected (0.01 sec)    MySQL> create table test2(id int,name varchar(5),type int,primary key(id));    Query OK, 0 rows affected (0.01 sec)    MySQL> select * from test1;    +-----+------+------+    | id | name | type |    +-----+------+------+    | 101 | aaa | 1 |    | 102 | bbb | 2 |    | 103 | ccc | 3 |    +-----+------+------+    3 rows in set (0.00 sec)    MySQL> select * from test2;    +-----+------+------+    | id | name | type |    +-----+------+------+    | 201 | aaa | 1 |    | 202 | bbb | 2 |    | 203 | ccc | 3 |    | 101 | xxx | 5 |    +-----+------+------+    4 rows in set (0.00 sec)   1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23.

    热门排行

    友情链接