Home  >  Article  >  Database  >  What happens if I use an integer value as a parameter to the MySQL LOCATE() function?

What happens if I use an integer value as a parameter to the MySQL LOCATE() function?

WBOY
WBOYforward
2023-08-27 13:45:02960browse

如果我使用整数值作为 MySQL LOCATE() 函数的参数,会发生什么情况?

MySQL allows us to use integer values ​​as arguments to the LOCATE() function. We don't need to use quotes. This 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)

The above is the detailed content of What happens if I use an integer value as a parameter to the MySQL LOCATE() function?. 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