分析:主键冲突,重复了
解决方案:
解决方案一.
- 删除重复记录
DELETE FROM user1
WHERE id NOT IN (
SELECT MIN(id)
FROM user1
GROUP BY name, gender, phone
);
解决方案二.
ELETE FROM user1
WHERE id NOT IN (
SELECT * FROM (
SELECT MIN(id)
FROM user1
GROUP BY name, gender, phone
) AS t
);
总结:最后我们再去查询一下,看是否删除了重复的,查询语句:SELECT * FROM user1;
成功解决如图: