Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

MySQL Evaluation of Non-Numeric Text Between Numbers in Quotes



Suppose if we are trying to add the numbers having non-numeric text between numbers of a string, then MySQL simply use the first number of that string to evaluate the addition along with a warning. Following example will exhibit this −

Example

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

From the above query, it is clear that MySQL uses only first number i.e. 1525 for evaluating the addition and ignores the non-numeric text.

Updated on: 2020-06-20T13:49:59+05:30

76 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements