justcode.ikeepstudying.com
Mysql: 搜索重复数据, 搜索重复值, 删除重复的行,How To Find Duplicate Values in MySQL,How To Delete Duplicate Rows in MySQL - Just Code
如何在MySQL中查找重复值 简介:在本教程中,您将学习如何在MySQL中查找一个或多个列的重复值。 发生数据重复的原因很多。查找重复值是使用数据库时必须处理的重要任务之一。 设置样本表 首先,创建一个表命名为contacts四列:id,first_name,last_name,和email。 CREATE TABLE contacts ( id INT PRIMARY KEY AUTO_INCREMENT, first_name VARCHAR(50) NOT NULL, last_name VARCHAR(50) NOT NULL, email VARCHAR(255) NOT NULL ); 其次,在表中插入行contacts: INSERT INTO contacts (first_name,last_name,email) VALUES ('Carine ','Schmitt','carine.schmitt@verizon.net'), ('Jean','King','jean.king@me.com'), ('Peter','Ferguson','peter.ferguson@google.com'), ('Janine ','Labrune','janine.labrune@aol.com'), ('Jonas ','Bergulfsen','jonas.bergulfsen@mac.com'), ('Janine ','Labrune','janine.labrune@aol.com'), ('Susan','Nelson','susan.nelson@comcast.net'), ('Zbyszek ','Piestrzeniewicz','zbyszek.piestrzeniewicz@att.net'), ('Roland','Keitel','roland.keitel@yahoo.com'), ('Julie','Murphy','julie.murphy@yahoo.com'), ('Kwai','Lee','kwai.lee@google.com'), ('Jean','King','jean.king@me.com'), ('Susan','Nelson','susan.nelson@comcast.net'), ('Roland','Keitel','roland.keitel@yahoo.com'); …