Home >Database >Mysql Tutorial >count(1),count(*),order by 1,2,3,4 区别

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

WBOY
WBOYOriginal
2016-06-07 15:48:342161browse

有图有真相 上图 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(*); co

有图有真相 上图

1 制造NULL数据;

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

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

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

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

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

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

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

5 ORDER BY 2   看看 结果正确

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

结果:

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

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

order by 1order by 2 oreder by 3;

order by 1=orderby  provcode

附加结果:

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

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn