html5官方网站开发流程,换友网站,群辉nas 做网站,微信公众号如何快速涨粉模糊查询是针对字符串操作的#xff0c;类似正则表达式#xff0c;没有正则表达式强大通配符#xff1a;_ 、% 、[] 、_ 表示任意的单个字符--查询MyStudent表中任意姓张#xff0c;名字两个字的姓名
select * from MyStudent where fname like 张_
--查询MyStudent表中任意…模糊查询是针对字符串操作的类似正则表达式没有正则表达式强大通配符_ 、% 、[] 、_ 表示任意的单个字符--查询MyStudent表中任意姓张名字两个字的姓名
select * from MyStudent where fname like 张_
--查询MyStudent表中任意姓张名字三个字的姓名
select * from MyStudent where fname like 张__
%表示匹配任意多个任意字符--查询MyStudent表中任意姓张的第一个为张的姓名字数不限的姓名
select * from MyStudent where fname like 张%
--查询MyStudent表中姓张的名字两个字的
select * from MyStudent where fname like 张%and len(fname) 2
[]表示筛选范--查询表中所有姓张第二个为数字第三个为妹的名字
select * from MyStudent where fname like 张[0-9]妹select * from MyStudent where fname like 张[a-z]妹select * from MyStudent where fname like 张[0-9a-z]妹--中间为1个字母和和1个数字字母大小写可以通过约束设定不区分大小写select * from MyStudent where fname like 张[!0-9]妹 --中间不为数字select * from MyStudent where fname not like 张[0-9]妹--不能以张开头妹结尾中间不能是数字同上不一样
--查询出表中包含通配符%的姓名 select * from MyStudent where fname like %[%]%--通配符放到[]中就转义了不是通配符了--查询表中包含[的姓名select * from MyStudent where fname like %/[% escape / --指定通配符为/--查询表中包含通配符[]的姓名select * from MyStudent where fname like %/[/]% escape / --指定通配符为/