Usually because of the database study is not deep, so in the interview asked some of the usual encountered problems incredibly can not be very sure to answer, really let oneself very angry!
One of the things that impressed me this time is:
when using aggregate functions in MySQL such as AVG (t), T is a field of type int in the table, nullable, with three rows of data, and the data in three rows are: 10,null,20, what is the final result?
My answer is 15, I tried it after the interview, but I was wrong about the handling of NULL on the aggregation function, and I think it was the aggregate function that would treat the null value as 0, and found that the blog was ignoring the null value because no description of the official documentation was found. Had to first agree with the blog of the cattle people said! If someone finds out, please give me an address, thank you!
Here is the result diagram of your own attempt ( note the Count function, which has a special case):
Avg Function:
Figure A
Figure II
count Function: Use COUNT (*)
Might
Figure Four
count Function: Use COUNT (xx), even with a specific field name
Figure Five
Figure Six
After your own testing, in the MySQL 5.6 environment in addition to count (*) as a special case ( do not ignore null values ), the rest of the aggregate function is really ignoring the null value (if Daniel is correct)!
Processing of NULL values using aggregate functions in MySQL