插入数据之前进行查看数据是否已经存在
INSERT INTO 数据表名称(字段1,字段2)
SELECT 插入的值1,值2 FROM DUAL
WHERE NOT EXISTS(SELECT * FROM 数据表名称
WHERE 字段1= 值1 AND 字段2= 值2)
DUAL 不需要进行修改
INSERT INTO table(file1,file2,file3,file4,file5,file6)
SELECT 1, 2,3,4,5,7 FROM DUAL
WHERE NOT EXISTS(SELECT * FROM table
WHERE file1= 1 AND file2= 2 AND file3= 3
AND file4= 4 AND file5= 5 AND file6= 6)
本文来自博客园,作者:CodeYaSuo,转载请注明原文链接:https://www.cnblogs.com/hany-postq473111315/p/15188264.html