I have a MySQL table (test) with utf-8 charset encoding. There are three entries, two entries with normal characters and another name with accent characters.
CREATE TABLE test (
id Integer,
name VARCHAR(50),
PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
INSERT INTO `test` (`id`, `name`) VALUES (1, 'aaaa');
INSERT INTO `test` (`id`, `name`) VALUES (2, 'AAAA');
INSERT INTO `test` (`id`, `name`) VALUES (3, 'áááá');
If I run the following select query, it returns all the 3 entries
Actual Result:-
select * from test where name like '%aa%';
id | name
----|----
1 | aaaa
2 | AAAA
3 | áááá
Instead of that, it should be return last entry with id=3.
I don't want to use 'BINARY' OR 'COLLATE utf8_bin' because it returns only case sensitive search.
I need normal search with string like query, e.g:-
Expected Result:-
select * from test where name like '%aa%';
id | name
---|-----
1 | aaaa
2 | AAAA