Home > Database > Mysql Tutorial > body text

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

WBOY
Release: 2023-08-27 13:45:02
forward
944 people have browsed it

如果我使用整数值作为 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)
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!