简体   繁体   English

计数命令与mysql中实际行总数之间的差异

[英]Difference between count command and real total number of rows in mysql

I use SQlyog Ultimate-MySQL, When I use count command to count all rows of a table, the result is different from the real total number of rows, what does this difference mean? 我使用SQlyog Ultimate-MySQL,当我使用count命令对表的所有行进行计数时,结果与实际的总行数不同,这意味着什么? How can I count real total number of rows? 如何计算实际的总行数?

COUNT(column) only counts NOT NULL values. COUNT(column)仅计算NOT NULL值。 To count real total, you can use COUNT(1) (or COUNT(0), COUNT('foo'), or pretty much anything - but COUNT(*) may be slower) 要计算实际总数,您可以使用COUNT(1)(或COUNT(0),COUNT('foo')或几乎所有其他内容-但COUNT(*)可能会更慢)

COUNT(column_name)函数返回指定列的值数(不计算NULL值)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM