Computer >> Computer tutorials >  >> Programming >> MySQL

What happens if I will use integer values as arguments of MySQL LOCATE() function?


MySQL allows us to use integer values as the arguments of the LOCATE() function. We do not need to use quotes. It can be demonstrated with the help of the following example −

Example

mysql> Select LOCATE(5,1698235);
+-------------------+
| LOCATE(5,1698235) |
+-------------------+
|                 7 |
+-------------------+
1 row in set (0.00 sec)

mysql> Select LOCATE(56,1698235);
+--------------------+
| LOCATE(56,1698235) |
+--------------------+
|                  0 |
+--------------------+
1 row in set (0.00 sec)

mysql> Select LOCATE(23,1698235);
+--------------------+
| LOCATE(23,1698235) |
+--------------------+
|                  5 |
+--------------------+
1 row in set (0.00 sec)