Operator + [wildcard like '_%'} composition fuzzy query
For example, the query trade names beginning with jet goods:
select prod_id,prod_name
from products
where prod_name like 'jet%';
查询的结果是:
prod_id | prod_name
100 | jetpack 155
101 | Jetpook 159
120 | Jetllllack 165
因为设置了不区分大小写所以就会查出来J和j
For example, the query trade names ending with jet goods:
select prod_id,prod_name
from products
where prod_name like '%jet';
查询的结果是:
prod_id | prod_name
100 | pack jet 155
101 | pookJet 159
120 | llllackJet 165
因为设置了不区分大小写所以就会查出来J和j
For example, the query trade names include jet letters of goods:
select prod_id,prod_name
from products
where prod_name like '%jet%';
查询的结果是:
prod_id | prod_name
100 | pack jetpack 155
101 | pookJetpook 159
120 | llllackJetllllack 165
因为设置了不区分大小写所以就会查出来J和j
Wildcard tips
Wildcard longer processing time is generally spent on search, so remember:
- Do not overuse wildcards, if other operators can achieve the purpose, you should use other wildcard
- When it does require the use of wildcards, unless absolutely necessary, do not put them in charge for the start of the search pattern. The wild card is placed at the beginning of the search pattern, searching up is the slowest.
- Carefully note the position of the wildcard, if misplaced, may not return the desired data.