SQL Where特殊的三个条件(between,in,like(字符串匹配,模糊查寻))

来源:互联网 发布:呼死你 淘宝上叫什么 编辑:程序博客网 时间:2024/05/16 11:48

 //between  and  和前一个SQL语句结果一样,有没多大的意义

 select *

 from dbo.MyClass
 where Age >10 and Age <20
 order by Age 
 //两个结果完成一样
 select *
 from MyClass
 where Age between 10 and 20

  order by Age

//in条件的用法

 select *
 from MyClass
 where Age=11 or Age =12 or Age =15
 order by Age 
  //两条SQL语句结果一样
 select *
 from MyClass
 where Age  in(11,12,15)
 order by Age  


//字符串匹配   //模糊查寻时用到

 //两个匹配通配符 %任意多个任意字符,_任意一个任意字符
  select *
 from MyClass
 where Name  like '罗%'



0 0
原创粉丝点击