Logical AND operator in mySql REGEXP?

前端 未结 5 1643
名媛妹妹
名媛妹妹 2020-12-17 19:28

I use MySql REGEXP:

SELECT * FROM myTable
WHERE title REGEXP \"dog|cat|mouse\";

The dataset is small, so I am not concerned about performan

5条回答
  •  余生分开走
    2020-12-17 19:51

    You can use full text search in boolean mode:

    SELECT * FROM table WHERE MATCH(colmun_name) AGAINST('+dogs +cat' IN BOOLEAN MODE);
    

    You must index your table first:

    ALTER TABLE table ADD FULLTEXT(column_name);
    

提交回复
热议问题