#查询列中含有 _ % 字符
selectfrom 表名 where 列名 like ‘%_%’;
selectfrom 表名 where 列名 regexp ‘.[].’;
select*from 表名 where 列名 regexp '..’;
#查询列中不含有_的字符
selectfrom 表名 where 列名 not like ‘%_%’;
selectfrom 表名 where 列名 not regexp ‘.[_].’ ;
#like
SQL LIKE 子句中使用百分号 %字符来表示任意字符,类似于UNIX或正则表达式中的星号 *。
如果没有使用百分号 %, LIKE 子句与等号 = 的效果是一样的。
like 匹配/模糊匹配,会与 % 和 _ 结合使用。
‘%a’ //以a结尾的数据
‘a%’ //以a开头的数据
‘%a%’ //含有a的数据
‘a’ //三位且中间字母是a的
‘a’ //两位且结尾字母是a的
'a’ //两位且开头字母是a的
::select *from 表名 where 列名 like ‘a%’ ;
模糊匹配以a开头的数据
::select *from 表名 where 列名 like ‘%a’ ;
模糊匹配以a结尾的数据
::select *from 表名 where 列名 like ‘%a%’ ;
模糊匹配含有a的数据
::select *from 表名 where 列名 like ‘a’ ;
模糊匹配三位且中间字母是a的
::select *from 表名 where 列名 like ‘a’ ;
模糊匹配两位且结尾字母是a的
::select *from 表名 where 列名 like 'a’ ;
模糊匹配两位且开头字母是a的