SQL 通配符
示例
通配符与SQLLIKE运算符一起使用。SQL通配符用于在表中搜索数据。
SQL中的通配符为:%,_,[charlist],[^charlist]
%-零个或多个字符的替代
Eg: //selects all customers with a City starting with "Lo"
SELECT * FROM Customers
WHERE City LIKE 'Lo%';
//selects all customers with a City containing the pattern "es"
SELECT * FROM Customers
WHERE City LIKE '%es%';_-代替单个字符
Eg://selects all customers with a City starting with any character, followed by "erlin" SELECT * FROM Customers WHERE City LIKE '_erlin';
[charlist]-匹配的字符集和范围
Eg://selects all customers with a City starting with "a", "d", or "l" SELECT * FROM Customers WHERE City LIKE '[adl]%'; //selects all customers with a City starting with "a", "d", or "l" SELECT * FROM Customers WHERE City LIKE '[a-c]%';
[^charlist]-仅匹配括号中未指定的字符
Eg://selects all customers with a City starting with a character that is not "a", "p", or "l" SELECT * FROM Customers WHERE City LIKE '[^apl]%'; or SELECT * FROM Customers WHERE City NOT LIKE '[apl]%' and city like '_%';
热门推荐
10 八一幼儿祝福语大全简短
11 公司乔迁食堂祝福语简短
12 婚礼结束聚餐祝福语简短
13 儿媳买车妈妈祝福语简短
14 毕业送礼老师祝福语简短
15 同事辞职正常祝福语简短
16 恭贺新婚文案祝福语简短
17 金店立秋祝福语简短英文
18 婆婆高寿祝福语大全简短