1、查询表中所有重复数据,根据单个字段 name 判断

select * from student where name in (select name from student group by name having count(*) > 1)

2、查询表中重复数据的数量,根据单个字段 name 判断

select count(name) as '重复次数',name from table group by name having count(*)>1

3、查找表中多余的重复记录,根据多个字段组合 sex,name 判断

select * from student where (sex,name) in ( select sex,name from student group by sex,name having count(*) > 1)

参考资料:MySQL GROUP BY 多个字段的用法说明