COUNT(id) vs. COUNT(*) in MySQL

前端 未结 3 1079
醉梦人生
醉梦人生 2020-12-03 07:17

Is there a difference between the following queries, assuming there is a primary field \'id\' in the table (as in speed, etc)?

SELECT COUNT(id) 
  FROM table         


        
3条回答
  •  佛祖请我去吃肉
    2020-12-03 07:37

    Count(*) Count(Ename) Can show diff outputs because Ename is not a column with Not null constraint and it surely be having some null values Which are not being counted.

    Hope it helps..!

提交回复
热议问题