关于mysql:instr字符查找函数的使用

10次阅读

共计 429 个字符,预计需要花费 2 分钟才能阅读完成。

MySql 的 sql 语句学习之 instr() 字符查找函数 的应用:

    INSTR(str,substr)str:从哪个字符串中搜寻

    substr: 要搜寻的子字符串

    instr()函数不辨别大小写
  1. instr(colName,string1)查问列名蕴含字符串 1 的后果,e.g,
    select userName from t_user_info where userName like concat("%",'江苏',"%");

    select userName from t_user_info where instr(userName,'江苏');
    select userName from t_user_info where instr(userName,'江苏')>0;
    查问后果雷同
  2. SELECT INSTR(string1,string2)在 string1 中查找 string2 字符串并输入下标,e.g,

https://www.cnblogs.com/mr-wuxiansheng/p/6531221.html

正文完
 0