database - MySQL inquiry does not make difference when using order by -


i create table like:

create table my_table (     value int(20) ) engine=innodb default charset=utf8; 

and insert data:

mysql> select * my_table; +-------+ | value | +-------+ |     0 | |     1 | |     2 | |     3 | +-------+ 

when execute select count(value), value my_table; , select count(value), value my_table order value desc;, both show:

+--------------+-------+ | count(value) | value | +--------------+-------+ |            4 |     0 | +--------------+-------+ 

my question is: why column @ right side 0? why order value desc doesn't make difference here?

order by processed after generates results. when use aggregate function count() without group by, aggregates selected rows, , produces 1 row of results. non-aggregated columns come indeterminate rows; order by clause has no effect on how row selected.


Comments

Popular posts from this blog

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -

YouTubePlayerFragment cannot be cast to android.support.v4.app.Fragment -