MYSQL 单词匹配的问题

来源:百度知道 编辑:UC知道 时间:2024/07/06 11:42:37
select publisher_name
from publisher
where publisher_name like '%and%';

结果
| publisher_name |
+--------------------------+
| Farrar Straus and Giroux |
| McPherson and Co. |
| Random House |
| Simon and Schuster |
| Thames and Hudson |
+--------------------------+

RANDOM 也包含 and 但是不是我需要的 怎么弄 可以把这个去掉

如果是英文单词,你可以写成
select publisher_name
from publisher
where publisher_name like '% and %';
(前后加空格)

但是效率很低,用得多,可以考虑建立 FULL TEXT 索引

select publisher_name
from publisher
where publisher_name like '% and %';