• MySql的like语句中的通配符:百分号、下划线和escape


    MySql的like语句中的通配符:百分号、下划线和escape
    %代表随意多个字符
    select * from user where username like '%huxiao';
    select * from user where username like 'huxiao%';
    select * from user where username like '%huxiao%';
    _代表一个字符
    Sql代码
    select * from user where username like '_';
    select * from user where username like 'huxia_';
    select * from user where username like 'h_xiao';
    假设我就真的要查%或者_,怎么办呢?使用escape,转义字符后面的%或_就不作为通配符了,注意前面没有转义字符的%和_仍然起通配符作用
    Sql代码
    select username from gg_user where username like '%xiao/_%' escape '/';
    select username from gg_user where username like '%xiao/%%' escape '/';
  • 相关阅读:
    向IPython Notebook中导入.py文件
    python--时间日期
    python--条件和循环
    python--输入输出
    python--字符串
    python--内置函数
    python--异常
    python--模块
    python--数据结构
    pybrain
  • 原文地址:https://www.cnblogs.com/lcchuguo/p/4059581.html
Copyright © 2020-2023  润新知