select count(1) from tb_user;-------------1
select count(1) from (select distinct * from tb_user) temp;-------------2
if (sql 1==sql 2)that means not exist the duplicate record in table tb_user,otherwise exist the duplicate record.
本文通过两个SQL查询对比的方式,检查数据库表tb_user中是否存在重复记录。首先统计所有记录数,然后统计去除重复后的记录数,若两者相等则表明表中没有重复数据。
select count(1) from tb_user;-------------1
select count(1) from (select distinct * from tb_user) temp;-------------2
if (sql 1==sql 2)that means not exist the duplicate record in table tb_user,otherwise exist the duplicate record.

被折叠的 条评论
为什么被折叠?