To conduct an Accent sensitive search in MySQL, we can use collation with utf8_bin. Here is the syntax to conduct accent sensitive search −
yourColumName dataType collate utf8_bin;
Apply the above syntax to conduct accent sensitive search. First, let us create a table −
mysql> create table AccentSearchDemo -> ( -> Id varchar(100) collate utf8_bin -> ); Query OK, 0 rows affected (0.51 sec)
Inserting three records into the table −
mysql> insert into AccentSearchDemo values('John123'); Query OK, 1 row affected (0.31 sec) mysql> insert into AccentSearchDemo values('Smith123'); Query OK, 1 row affected (0.15 sec) mysql> insert into AccentSearchDemo values('123John'); Query OK, 1 row affected (0.11 sec)
Now we can display all the records with the help of SELECT statement. The query is as follows −
mysql> select *from AccentSearchDemo;
Here is the output −
+----------+ | Id | +----------+ | John123 | | Smith123 | | 123John | +----------+ 3 rows in set (0.00 sec)