1.count()和sum()
count(*)和count(1)的区别:
1.count(*)会进行全表扫描;不会过滤掉一整行为null的行
2.count(1) 会过滤掉一整行值为null的值
sum(0)和sum(1)的区别:
sum(0):0
sum(1):满足条件的数据有多少条
sum(2):等于 2倍的count(*)
1.count(*)会进行全表扫描;不会过滤掉一整行为null的行
2.count(1) 会过滤掉一整行值为null的值
sum(0):0
sum(1):满足条件的数据有多少条
sum(2):等于 2倍的count(*)