like%的用法
前面提到使用
select * from [Production].[Product]
where name like'mountain%' -- "_" matches any single character
會顯示moutain在前面的數(shù)據(jù),那如果使用下面的命令
select * from [Production].[Product]
where name like'%mountain' -- "_" matches any single character
為什么只出現(xiàn)了一個數(shù)據(jù)呢??像LL mountain rim的數(shù)據(jù)也不會出現(xiàn)
2015-11-30
很簡單,%mountain%是指前后都有字符,mountain%是指前面mountain沒字符,%mountain是指mountain后面沒字符。所以像LL mountain rim這樣前后都有字符的當(dāng)然不符合%mountain的定義,也就不會被選出來了。
2015-08-05
是模糊查詢 ?就代表你數(shù)據(jù)庫里面就這一條數(shù)據(jù)