MYSQL 插入数据防止重复

来源:互联网 发布:淘宝店铺优化软件 编辑:程序博客网 时间:2024/06/05 17:38
Sql代码 insert into tt(name,password) select 'phl','123' from dual where not exists(select * from tt where name='phl' and password='123') insert into tt(name,password) select 'phl','123' from dual where not exists(select * from tt where name='phl' and password='123')这个SQL语句的含义是,如果插入的数据 name='phl',password='123'不存在,则执行插入;
原创粉丝点击