count(1),count(*),order by 1,2,3,4 区别

来源:互联网 发布:西班牙语发音软件 编辑:程序博客网 时间:2024/06/11 07:50

count(1),count(*),order by 1,2,3,4 区别

分类: Oracle 开发 1201人阅读 评论(0)收藏 举报
制造null

有图有真相 上图

1 制造NULL数据;

2 直接用列名来COUNT下看结果

3 用 1 2 3 4 5 * 来COUNT 下看下结果 发现都是一样的数据 都是等于全部函数.

4 ORDER BY 1 确实使用第一列来排序

5 ORDER BY 2   看看 结果正确

结果:

count(1)=count(2)=count(3)=count(*);

count(provcode)<>count(areacode)<>count(statedate)<>count(*);

order by 1<>order by 2<> oreder by 3;

order by 1=orderby  provcode

附加结果:

0 0