--查找姓名、性别、年齡、位址、電話相同的員工記錄。
select count(id) as id_count,
name,
sex,
birthday,
address,
tel
from staff
group by
having(count(*) > 1);
--删除姓名、性别、年齡、位址、電話相同的重複員工記錄(保留id最大的一條)。
delete staff where id not in (select max(id) from staff group by name, sex,
birthday, address, tel);