--區(qū)分大小寫性能比較低select * from Students where Age >1 and Age <4select * from Students where Age between 1 and 4--取出一到四的數(shù)據(jù)包含一和四(between在數(shù)據(jù)庫有優(yōu)化,性能比較好,高于上面的語句)select * from Students where Age in(1,2,3)--查詢出年齡包含1,2,3的數(shù)據(jù)select * from Students where Name like 'a%' --以a開頭的后面不管有幾個(gè)字符都可以匹配select * from Students where Name like '_a%'--第二個(gè)字符是a的,_表示一個(gè)任意字符select * from Students where Name like '__a%' --前兩個(gè)是任意字符,第三個(gè)是a字符的進(jìn)行匹配select * from Students where Name like '%[0-9]%'--查詢中間任何位置有數(shù)字的select * from Students where Name like '%[a-z]%'--查出中間任何位置有字母的select * from Students where Name like '%[0-9a-z]%'--查詢中間任何位置有數(shù)字或字母的select * from Students where Name like '%[^0-9]%' --查詢中間任何位置不是數(shù)字的select * from Students where Name like '%[^0-9]' --查詢最后位置不是數(shù)字的select * from Students where Name not like '%[0-9]'
新聞熱點(diǎn)
疑難解答
圖片精選