Home > Database > Mysql Tutorial > How does MySQL calculate if we write non-numeric text between numbers in a string when adding numbers contained in quotes?

How does MySQL calculate if we write non-numeric text between numbers in a string when adding numbers contained in quotes?

王林
Release: 2023-09-04 14:45:02
forward
1000 people have browsed it

在添加引号中包含的数字时,如果我们在字符串的数字之间写入非数字文本,MySQL 如何计算?

Suppose we try to add non-numeric text between numbers in a string, then MySQL will use only the first number of the string to calculate the addition, and Comes with a caveat. The following example will demonstrate this −

Example

mysql> Select '1525 * 2' + '200'As Total;
+-------+
| Total |
+-------+
| 1725  |
+-------+
1 row in set, 1 warning (0.00 sec)
Copy after login

It is clear from the above query that MySQL only uses the first number (i.e. 1525) to calculate the addition and ignores non- Digital text.

The above is the detailed content of How does MySQL calculate if we write non-numeric text between numbers in a string when adding numbers contained in quotes?. For more information, please follow other related articles on the PHP Chinese website!

source:tutorialspoint.com
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