例如我們錨定student_id
select count(1),
count(distinct student_id) ----注意distinct 的重要使用
from
abc.table_student;
不一致那麼就有重複值,會出現一對多,一個id多條信息
或者:
select student_id,count(1) from abc.table_student
group by student_id
having count(1)>=2;
-----注意having的用法
-----爲什麼用count(1)呢,一般id肯定是超過1位數的