如何在 MySQL 中运行查询以搜索包含多次出现的字符的字符串?
SELECT * FROM animals WHERE name LIKE '%r%'
只会返回包含“r”的动物..
+---------+------------+
| id | name |
+---------+------------+
| 1 | zebra |
| 14 | raccoon |
| 25 | parrot |
| 49 | rhinoceros |
+---------+------------+
SELECT * FROM animals WHERE name LIKE '%rr%'
只会返回包含“rr”出现的动物..
+---------+------------+
| id | name |
+---------+------------+
| 25 | parrot |
+---------+------------+
我想找到任何包含“r”的动物名称。让我们在名称中的任何地方说两次。
+---------+------------+
| id | name |
+---------+------------+
| 25 | parrot |
| 49 | rhinoceros |
+---------+------------+
任何人?