1. 程式人生 > >mysql查看數據表是否有重復數據

mysql查看數據表是否有重復數據

-s having -h light HERE 查看 strong 速度 mysq

  1. 我們可以用
    select * from people where peopleId in (select peopleId from people group by peopleId having count(peopleId) > 1) select * from Users where UserId in (select UserId from Users group by UserId having count(UserId) > 1)

    不過在數據量過大的時候查詢的速度會非常慢


    select count(peopleId) from people
    select count(distinct peopleId) from people 我們可以用上面兩條語句的結果進行對比判斷是否存在重復數據

mysql查看數據表是否有重復數據