数据库 mysql sql 语句实现模糊查询 SELECT * FROM table WHERE keyword LIKE '%xxx%'
like 关键字 结合百分号%
实现 模糊查询
原本精确查询: 匹配 title 为 testadgddsdf 的数据
SELECT * FROM table WHERE title='testadgddsdf'
现在模糊查询:
- 匹配title 字段包以
tes
为起始的数据:
SELECT * FROM table WHERE title LIKE 'tes%'
- 匹配title 字段以
tes
为结尾的数据:
SELECT * FROM table WHERE title LIKE '%tes'
- 匹配 title 字段包含
tes
为开头、任意位置、结尾的数据
SELECT * FROM table WHERE title LIKE '%tes%'
A little hug, little gift.
All of little something.
these are our meories.