MySQL中insert if not exists防止插入重复记录sql语句写法
对一下表中插入一条数据判断存在不插入,不存在就插入
语句解释
insert into shua_config (id,file,type,content) insert into 数据表表明 (数据表字段) select id,'', 'accesstoken','' (插入表项中的对应值 和VALUES一样对应填写) from dual where not exists( select id from shua_config where type = 'accesstoken' (查询语句,查询某个字段内容是否存在) );
合并语句 insert into shua_config (id,file,type,content) select null,'', 'accesstoken','' from dual where not exists( select id from shua_config where type = 'accesstoken' );
1、本站目前拥有近 1000+ 精品收费资源,现在加入VIP会员即可全部下载。
2、本资源部分来源其他付费资源平台或互联网收集,如有侵权请联系及时处理。
SEA模板网 » MySQL中insert if not exists防止插入重复记录sql语句写法
2、本资源部分来源其他付费资源平台或互联网收集,如有侵权请联系及时处理。
SEA模板网 » MySQL中insert if not exists防止插入重复记录sql语句写法
发表评论