0%

MySQL count

MySQL count

在使用count进行数据统计行数时,有时候会使用count(*),有时候会使用count(1),有时候会使用count(列名),那么这些有什么不同呢

当使用列名作为参数时,count函数会自动忽略null值,而使用*或者常量时,就会包含null值

1
2
3
4
select count(*),count(1),count(source) from doc  

count(*) count(1) count(source)
188 188 2

欢迎关注我的其它发布渠道