数据库表
ID | name | age |
---|---|---|
1 | 王小明 | 23 |
2 | 王大明 | 24 |
3 | 李华 | 13 |
3 | 李明 | 13 |
语句
select * from name where day like "--"
语句形式
ID | name |
---|---|
%a | 以a结尾的数据 |
a% | 以a开头的数据 |
%a% | 含有a的数据 |
_ a _ | 三位且中间字母是a的 |
_ a | 两位且结尾字母是a的 |
a _ | 两位且开头字母是a的 |
举例
- select * from name where day like "%明"
ID | name | age |
---|---|---|
1 | 王小明 | 23 |
2 | 王大明 | 24 |
3 | 李明 | 13 |
- select * from name where day like "王%"
ID | name | age |
---|---|---|
1 | 王小明 | 23 |
2 | 王大明 | 24 |