假设有这样一个需求:在 MySQL 数据库中查找先后出现“AAA”、“BBB”和“CCC”三个关键字的记录。表中包含 227,050 条记录,查找字段为”en_segment“,类型为“text”,采用 InnoDB 作为数据库引擎。请看下面两条记录:
AAA competes with BBB, CCC and other tech giants to create or buy movies and television shows ― both foreign and domestic, with iQiyi showing a range of programs from Chinese costume dramas to American shows like “Homeland” ― that Chinese viewers stream through their smartphones, tablets and computers.
The companies that have managed to claim online beachheads, particularly BBB, CCC and the search engine AAA, have demonstrated astonishing growth.
第一条记录满足要求。第二条虽然包含全部关键字,但顺序不一致。
针对这一需求,一种方法是通过”LIKE”运算符实现模糊查询,对应的 SQL 语句为:
SELECT