摘要:

下文讲述MySQL数据库下INSTR函数的功能及举例说明,如下所示;

MySQL INSTR 功能及语法说明

INSTR 函数功能,返回指定字符串在源字符串的起始位置

INSTR 函数语法:

INSTR(STR,SUBSTR)

—-参数说明———

STR: 被搜索的字符串

SUBSTR:待查找字符串

—返回值—-

返回SUBSTR字符串在STR中的起始位置

位置计数从1开始

如SUBSTR字符串不存在于STR中,则返回0

MySQL INSTR 函数举例应用

mysql > select instr('maomao365.com','.com');

+-------------------------------+

| instr('maomao365.com','.com') |

+-------------------------------+

| 10 |

+-------------------------------+

1 row in set (0.00 sec)

mysql > select instr('maomao365.com','m');

+----------------------------+

| instr('maomao365.com','m') |

+----------------------------+

| 1 |

+----------------------------+

1 row in set (0.00 sec)

25954b7dae819ce576a1452558cfe75d.gif

MySQL_INSTR函数应用说明

更多推荐