您好,欢迎访问一九零五行业门户网

哪些 MySQL 函数的工作方式与 LOCATE() 函数类似?

mysql instr() 和 position() 函数的工作方式与 locate() 函数类似。它们都是 locate() 函数的同义词。
instr() 函数还返回从字符串中搜索后子字符串第一次出现的位置。 instr() 的语法如下 -
instr() 的语法instr(string, substring)
这里,string是mysql要搜索的字符串,substring是要搜索的字符串。
示例mysql> select instr('ram is a good boy', 'good')as result;+--------+| result |+--------+| 10 |+--------+1 row in set (0.00 sec)
position() 函数还返回从字符串中搜索后子字符串第一次出现的位置。 position() 的语法如下 -
position() 的语法instr(substring in string)
这里,string是mysql要搜索的字符串。
substring是要搜索的字符串。
'in'是关键字。
示例mysql> select position('good' in 'ram is a good boy')as result;+--------+| result |+--------+| 10 |+--------+1 row in set (0.00 sec)
以上就是哪些 mysql 函数的工作方式与 locate() 函数类似?的详细内容。
其它类似信息

推荐信息