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  >  Article  >  Database  >  How does the MySQL SUM() function evaluate whether it gets a column with character data type as its argument?

How does the MySQL SUM() function evaluate whether it gets a column with character data type as its argument?

WBOY
WBOYforward
2023-09-02 22:33:02921browse

MySQL SUM() 函数如何评估它是否获得具有字符数据类型的列作为其参数?

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" -

Example

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!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete