I would like to search a MySQL database for author names. The issues is the same author name can be spelled (or entered into the database) in a variety of ways. I need to check for similar names.
A sample of my authors
table is as follows;
+---------+-------------+
| id | author |
+---------+-------------+
| 1 | JK Rowling |
+---------+-------------+
| 2 | J.K Rowling |
+---------+-------------+
| 3 | Rowling JK |
+---------+-------------+
| 4 | Rowling J.K |
+---------+-------------+
| 5 | JK. Rowling |
+---------+-------------+
| 6 | Jim Jones |
+---------+-------------+
I want to find all books by 'J.K Rowling', so the query I am using is;
SELECT *
FROM `authors`
WHERE `author` LIKE '%J.K Rowling%'
Returns no results
.
SELECT *
FROM `authors`
WHERE `author` LIKE 'J.K Rowling%'
Returns no results
.
SELECT *
FROM `authors`
WHERE `author` LIKE '%J.K Rowling'
Returns no results
.
How should I structure the query in order to return similar authors.
Thanks