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


苦瓜蘸芥末
1 声望0 粉丝