飙血推荐
  • HTML教程
  • MySQL教程
  • JavaScript基础教程
  • php入门教程
  • JavaScript正则表达式运用
  • Excel函数教程
  • UEditor使用文档
  • AngularJS教程
  • ThinkPHP5.0教程

Oracle中count函数(转)

时间:2021-12-15  作者:匿名  
SELECT count(*) from yq1012;  
SELECT count(1) from yq1012;  
SELECT count(column1) from yq1012;  
SELECT count(distinct column1) from yq1012;

   count(*)

   count(1)

   上两个方法执行结果相同,但是效率会有轻微的差别

   count(*)走的是标识列,就是隐藏列rowid效率稍高

   count(1)走的是行赋值,要用的话一般会使用count(主键)

   count(column1)

   不包括column1为null的记录

   count(distinctcolumn1)

   不包括column1为null的记录,且去除重复

湘ICP备14001474号-3  投诉建议:234161800@qq.com   部分内容来源于网络,如有侵权,请联系删除。