I have a SQLite database with a table named minecraft.
+----+----------------------+
| id | name |
+----+----------------------+
| 1 | Pocket Mine MP |
| 2 | Open Computers |
| 3 | hubot minecraft skin |
| 4 | Terasology |
| 5 | msm |
+----+----------------------+
I need to find all the records which have 'e' and 'o' in their 'name' field. Here is my Select query:
select * from minecraft where name like '%e%o%'
Here is the result of the above query:
+----+----------------+
| id | name |
+----+----------------+
| 2 | Open Computers |
| 4 | Terasology |
+----+----------------+
The problem is that the Like predicate matches the entire value, not words. The row with id = 2 should not be matched, because all the criteria didn't happen in a single word ('e' is found in the first word and 'o' in the other word): Open Computers.
How should I change my Select query so it matches the only row with 'e' and 'o' in a single word?
+----+------------+
| id | name |
+----+------------+
| 4 | Terasology |
+----+------------+
Thanks