无则插入有则更新
PostgreSQL
无则插入有则更新
conflict(带有唯一性约束的字段),根据此字段判断是更新还是插入
INSERT INTO student(id,name,sex)VALUES('1', '小明', '男') ON conflict (id) DOUPDATE SET id= '1',name= '小明',sex= '男';
无则插入有则不做操作
INSERT INTO student(id,name,sex)VALUES('1', '小明', '男') ON conflict (id) DO nothing;
MySQL,Oracle、SqlServer
mysql:https://www.cnblogs.com/luoxiao1104/p/17027999.html
[MySQL,Oracle,SqlServer]:https://blog.csdn.net/weidu01/article/details/111939654
来源地址:https://blog.csdn.net/weixin_42949219/article/details/132280439