Home  >  Article  >  Database  >  When adding numbers enclosed in quotes, how does MySQL calculate if we write non-numeric text after the number?

When adding numbers enclosed in quotes, how does MySQL calculate if we write non-numeric text after the number?

王林
王林forward
2023-09-18 16:49:17950browse

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

Suppose if we try to add a number followed by non-numeric text, then MySQL will simply discard the non-numeric text and evaluate the addition of the numeric value with a warning. The following example will demonstrate this -

Example

mysql> Select '1525 Kg' + '200 Oz'As Total;
+-------+
| Total |
+-------+
| 1725  |
+-------+
1 row in set, 2 warnings (0.00 sec)

The above is the detailed content of When adding numbers enclosed in quotes, how does MySQL calculate if we write non-numeric text after the number?. 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