BetWeen和模糊查询

王朝学院·作者佚名  2016-05-26
窄屏简体版  字體: 小  |  中  |  大  |  超大  

BetWeen和模糊查询--区分大小写性能比较低select * from Students where Age >1 and Age <4select * from Students where Age between 1 and 4--取出一到四的数据包含一和四(between在数据库有优化,性能比较好,高于上面的语句)select * from Students where Age in(1,2,3)--查询出年龄包含1,2,3的数据select * from Students where Name like 'a%' --以a开头的后面不管有几个字符都可以匹配select * from Students where Name like '_a%'--第二个字符是a的,_表示一个任意字符select * from Students where Name like '__a%' --前两个是任意字符,第三个是a字符的进行匹配select * from Students where Name like '%[0-9]%'--查询中间任何位置有数字的select * from Students where Name like '%[a-z]%'--查出中间任何位置有字母的select * from Students where Name like '%[0-9a-z]%'--查询中间任何位置有数字或字母的select * from Students where Name like '%[^0-9]%' --查询中间任何位置不是数字的select * from Students where Name like '%[^0-9]' --查询最后位置不是数字的select * from Students where Name not like '%[0-9]'

 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
© 2005- 王朝網路 版權所有 導航