--区分大小写性能比较低
select * from Students where Age >1 and Age
<4
select * 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]‘
原文:http://www.cnblogs.com/sumg/p/3649446.html