mysql中count(1)、count(*)和count(列名)的区别
结论:
1、count(1)和count(*)执行结果是一样的,不会忽略列中有null的行(会统计值为null的行);
2、count(列名)统计的时候,不会统计列名值为null的行;
使用count(1)结果是5
使用count(*)结果是5
使用count(列名)结果是3
结论:
1、count(1)和count(*)执行结果是一样的,不会忽略列中有null的行(会统计值为null的行);
2、count(列名)统计的时候,不会统计列名值为null的行;
使用count(1)结果是5
使用count(*)结果是5
使用count(列名)结果是3