结论:

1、count(1)和count(*)执行结果是一样的,不会忽略列中有null的行(会统计值为null的行);

2、count(列名)统计的时候,不会统计列名值为null的行;

mysql中count(1)、count(*)和count(列名)的区别

使用count(1)结果是5

mysql中count(1)、count(*)和count(列名)的区别

使用count(*)结果是5

mysql中count(1)、count(*)和count(列名)的区别

使用count(列名)结果是3

mysql中count(1)、count(*)和count(列名)的区别

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-16
  • 2021-12-08
  • 2021-10-04
猜你喜欢
  • 2022-03-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-31
  • 2021-08-27
相关资源
相似解决方案