mysql的like语句中的几个通配符
MySql的like语句中的通配符:百分号、下划线和escape %代表任意多个字符 Sql代码 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'; 如果我就真的要查%或者_,怎么办呢?使用escapemysql通配符使用,转义字符后面的%或_就不作为通配符了,注意前面没有转义字符的%和_仍然起通配符作用 Sql代码 select username from gg_user where username like '%xiao/_%' escape '/'; select username from gg_user where username like '%xiao/%%' escape '/'; (编辑:鄂州站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- php C 特殊字符无法插入数据库
- 有没有办法在MySQL查询中包含重复项:select..from..where.
- php – 使用MySQL的UNION中每个SELECT的不同ORDER BY
- 插入语句中C#应用程序中的MySql ODBC 5.1驱动程序的内存分配
- linux 实现MYSQL启动与访问的方法
- MYSQL教程MySQL中使用SQL语句对字段进行重命名
- mysql – ZF2如何使用join重命名字段名称
- MYSQL教程Mysql中order by、group by、having的区别深入分析
- Python MySQLdb executemany
- java – 如何检查数据库中的删除是否成功?