要求从表A查数据插入到表B中,并且要求如果表A中已存在的数据,就不要重复插入
2014-01-08 09:41
253 查看
insert into A select * from B where not exists (select 1 from A where A.ID=B.ID)
insert when (not exists (select 1 from 表名 where 检验重复的条件)) then into 表名 values(相应的值)select 1 from dual
insert when (not exists (select 1 from 表名 where 检验重复的条件)) then into 表名 values(相应的值)select 1 from dual
相关文章推荐
- 要求从表A查数据插入到表B中,并且要求如果表A中已存在的数据,就不要重复插入
- mysql insert插入时实现如果数据表中主键重复则更新,没有重复则插入的四种方法
- oracle mybatis(Mergr into语句带序列)添加数据时如果数据存在就更新,如果不存在就插入
- mybatise+oracle添加数据时如果数据存在就更新,如果不存在就插入
- MySQL插入数据时,如果记录不存在则insert,如果存在则update
- mysql如何实现插入数据时如果不存在则插入如果存在则更新的操作
- 用存储过程处理插入值重复时(如果插入id值存在时,在存在id值增1后再插入)
- mysql将一个表的数据插入到另外一个表,如果某个字段已经存在将不插入的sql
- Mysql存在唯一索引条件下,实现插入如果重复则自动更新
- SQL 语句之insert语句插入数据;若表中有重复的主键或数据插入的时候要求不能报错
- 一条SQL搞定 插入数据主键重复或数据已经存在,则更新这条数据
- mysql学习总结一当数据不存在的时候插入,存在的时候进行更新,删除重复数据
- SQL-从B表往A表插入数据,如果A表有相同数据不重复插入。
- Mysql 如果数据存在则更新,不存在则插入
- MySQL插入数据时,如果记录不存在则insert,如果存在则update
- 用存储过程处理插入值重复时(如果插入id值存在时,在存在id值增1后再插入)
- mybatis+oracle添加数据时如果数据存在就更新,如果不存在就插入
- 11周2-2项目 - 存储班长信息的学生类,将Stu类的数据成员的访问权限改为private,你的程序是否能完成要求的功能?如果不行,请修改程序。请不要修改给出的代码,只能修改自己写的代码。
- mysql_mybatis添加数据时如果数据存在就更新,如果不存在就插入
- mysql insert插入时实现如果数据表中主键重复则更新,没有重复则插入的四种方法