首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

Select Count (*)跟Select Count(1)以及Select Count(column)区别

2012-07-16 
Select Count (*)和Select Count(1)以及Select Count(column)区别?? 1.? 一般情况下,Select Count (*)和Se

Select Count (*)和Select Count(1)以及Select Count(column)区别

?? 1.? 一般情况下,Select Count (*)和Select Count(1)两者的返回结果是一样的

?? 2.? 假如表沒有主键(PK), 那么count(1)比count(*)快, 如果有主键PK的話,那count(主键)最快, 如果你的表只有一个字段的话那count(*)就是最快的

?? 3. count(*) 跟 count(1) 的结果一样,都包括对NULL的统计,而count(column) 是不包括NULL的统计

热点排行