count是统计数据条数,distinct是去掉重复列;
count统计的时候会忽略null值,distinct会将重复的null值列作为一个。
综上select count(null) from table,结果永远是0。
常见到count(*),count(1),count(field)的统计写法,这里记录下区别:
综上,count(*)和count(1)结果一致,和count(field)不一定一致。
原文:https://www.cnblogs.com/lxyit/p/9409278.html