一:

1、alter table "表名" add unique index(`字段1`,`字段2`)

2、insert into "表名" (`name`,`age`,`time`)values('zhangsan','18','2001:10:10') on duplicate key update `name`=values(`name`),`age`=values(`age`)

二:

REPLACE INTO test1(user_id,user_name) 
SELECT user_id,user_name FROM test2;
如果导入时,没有指定列,则未指定的列的数据,将会被替换为(Null)

三:
INSERT IGNORE INTO test1(user_id,user_name,user_type) 
SELECT user_id,user_name,user_type FROM test2;

 四、

insert IGNORE  into table1 select * from table2

相关文章:

  • 2021-07-18
  • 2022-12-23
  • 2022-12-23
  • 2021-09-07
  • 2021-11-15
  • 2021-11-23
  • 2021-11-27
  • 2022-12-23
猜你喜欢
  • 2021-11-04
  • 2021-05-19
  • 2022-12-23
  • 2021-11-29
  • 2021-08-28
  • 2021-06-21
  • 2022-12-23
相关资源
相似解决方案