Home > Database > Mysql Tutorial > 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?

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2023-09-02 22:33:02
forward
1031 people have browsed it

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)
Copy after login

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 of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template