1、个体暗昧查问
1. 双前提盘问
//查问一切姓名包括“弛”的记实
select * from student where name like '弛'二. 多前提盘问
//盘问一切姓名蕴含“弛”,地点包罗四川的记实
select * from student where name like '弛' and address like '四川'
//查问一切姓名包罗“弛”,或者者所在包罗四川的记实
select * from student where name like '弛' or address like '四川'2、使用通配符查问
通配符:_ 、% 、[ ]
1. _ 显示随意率性的双个字符
//盘问一切名字姓弛,字少2个字的记载
select * from student where name like '弛_'
//盘问一切名字姓弛,字少三个字的纪录
select * from student where name like '弛__'两. % 表现婚配随意率性多个随意率性字符
//盘问一切名字姓弛,字少没有限的纪录
select * from student where name like '弛%'
//查问一切名字姓弛,字少二个字的纪录
select * from student where name like '弛%'and len(name) = 两3. [ ]表现挑选领域
//查问一切名字姓弛,第2个为数字,第三个为燕的纪录
select * from student where name like '弛[0-9]燕'
//查问一切名字姓弛,第2个为字母,第三个为燕的纪录
select * from student where name like '弛[a-z]燕'
//盘问一切名字姓弛,中央为1个字母或者1个数字,第三个为燕的名字。字母巨细写否以经由过程约束设定,没有分辨巨细写
select * from student where name like '弛[0-9a-z]燕'
//盘问一切名字姓弛,第2个没有为数字,第三个为燕的记载
select * from student where name like '弛[!0-9]燕'
//盘问名字除了了伸开头妹末端中央是数字的记实
select * from student where name not like '弛[0-9]燕'4. 盘问包罗通配符的字符串
//盘问姓名包括通配符%的纪录
select * from student where name like '%[%]%' //经由过程[]本义
//盘问姓名蕴含[的记载
select * from student where name like '%/[%' escape '/' //经由过程指定'/'本义
//查问姓名包括通配符[]的记载
select * from student where name like '%/[/]%' escape '/' //经由过程指定'/'本义到此那篇闭于SQL完成含混查问的四种办法年夜结的文章便先容到那了,更多相闭SQL 迷糊查问形式请搜刮剧本之野之前的文章或者连续涉猎上面的相闭文章心愿大师之后多多支撑剧本之野!

发表评论 取消回复