当前位置:首页 > 数据库 > 正文

mysql count的理解

2020-03-02 数据库

mysql count的理解

1 select count(tel) as telcount from info;
如果tel列有null 将不会被统计进去

2 count(*) 这样写性能更好

3 MYISAM引擎 只有当没有where的时候 count(*) 查询才会达到神一样的速度!!
看下面例子就知道了
EXPLAIN SELECT count(id) FROM `grs_record_login`
row竟然没有值

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/SQL/22124.html