1> select browser,count(*) from logtest group by browser;
+-----------+----------+
| browser | count(*) |
+-----------+----------+
| Firefox 3 | 14 |
| Unknown | 11 |
+-----------+----------+
2 lines in a set
2> select browser,count(browser) from logtest group by browser;
+-----------+----------------+
| browser | count(browser) |
+-----------+----------------+
| Firefox 3 | 14 |
| Unknown | 11 |
+-----------+----------------+
2 lines in a set
3> select browser,count(browser) from logtest;
+-----------+----------------+
| browser | count(browser) |
+-----------+----------------+
| Firefox 3 | 25 |
+-----------+----------------+
1 row in a set
Why does the query method 1> and 2> produce the same result? Does the difference between counting (*) and count (somefiled) not exist?
Also, if the query 2> and 3> will lead to a different result, why is groupby so magic? How it works?
UPDATE: I am using MySQL5.1. :)
source
share