presto如何确认没有重复的数据

例如我们锚定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位数的

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章