mysql 使用 insert ignore into和unique实现不插入重复数据功能

执行插入操作,如果数据库中不存在才插入,否则就不插入

首先需要通过unique指定唯一约束字段

然后写sql语句的时候就写  insert ignore into () valuse ()

这样就能实现不需要判断就能避免插入重复数据的功能

原文地址:https://www.cnblogs.com/luludongxu/p/4708620.html