本MySQL教程通过语法和示例说明了如何使用MySQL INSTR函数。
MySQL INSTR函数将返回字符串中子字符串的位置。
MySQL中INSTR函数的语法为:
INSTR( string,
substring
)
说明 字符串中的第一个位置是1。 INSTR函数查找时,不区分大小写 如果在string中找不到substring,则INSTR函数将返回0。
说明
在MySQL中,如何在字符串中查找子字符串的位置?MySQL INSTR函数示例:
mysql>
SELECT
INSTR(
'yun kai bi ji'
,
'yun'
);
Result: 1
'y'
'k'
Result: 5
'YUN KAI BI JI'
'K'
'igiftidea.com'
'ee'
Result: 10
'abc'
Result: 0
原文链接:https://codingdict.com/