Home  >  Article  >  Database  >  If I try to add two numbers enclosed in quotes, how does MySQL calculate it?

If I try to add two numbers enclosed in quotes, how does MySQL calculate it?

WBOY
WBOYforward
2023-08-26 10:21:081000browse

如果我尝试将引号中包含的两个数字相加,MySQL 如何计算?

If we try to add two numbers contained in quotes, it means we are treating the string as a number. In this case, MySQL converts the value to the nearest numeric value and evaluates the result. The following example demonstrates this.

Example

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

The above is the detailed content of If I try to add two numbers enclosed in quotes, how does MySQL calculate it?. 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