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 给外婆敬酒祝福语简短