While adding the numbers contained in quotes, how MySQL evaluates if we write non-numeric text before a number?


Suppose if we are trying to add the numbers having non-numeric text before them, then MySQL simply evaluate the value of such number as 0. Following example will exhibit this −

Example

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

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

Anjana
Anjana

e

Updated on: 20-Jun-2020

41 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements