Select*fromSocial;+------+-------+|Id |Name |+---- --+-------+|100 |Rahul|+------+-------+1rowinset(0.00sec)mysql>SelectSUM(Name)FromSocial;+"/> Select*fromSocial;+------+-------+|Id |Name |+---- --+-------+|100 |Rahul|+------+-------+1rowinset(0.00sec)mysql>SelectSUM(Name)FromSocial;+">
Home >Database >Mysql Tutorial >How does the MySQL SUM() function evaluate whether it gets a column with character data type as its argument?
The MySQL SUM() function will return 0 instead of NULL and issue a warning when getting a character type column as its argument. The following example will be illustrated using data from a table named "Social" -
mysql> Select * from Social; +------+-------+ | Id | Name | +------+-------+ | 100 | Rahul | +------+-------+ 1 row in set (0.00 sec) mysql> Select SUM(Name) From Social; +-----------+ | SUM(Name) | +-----------+ | 0 | +-----------+ 1 row in set, 1 warning (0.00 sec)
The above is the detailed content of How does the MySQL SUM() function evaluate whether it gets a column with character data type as its argument?. For more information, please follow other related articles on the PHP Chinese website!