You can use BINARY along with the LIKE operator. Let us first create a table −
mysql> create table DemoTable ( Header text ); Query OK, 0 rows affected (1.09 sec)
Insert records in the table using insert command −
mysql> insert into DemoTable values('Programming tutorials on MySQL'); Query OK, 1 row affected (0.11 sec) mysql> insert into DemoTable values('programming in Java language'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('Program in C language'); Query OK, 1 row affected (0.15 sec) mysql> insert into DemoTable values('pRograMMing in Python language'); Query OK, 1 row affected (0.41 sec)
Display all records from the table using select statement −
mysql> select * from DemoTable;
This will produce the following output −
+--------------------------------+ | Header | +--------------------------------+ | Programming tutorials on MySQL | | programming in Java language | | Program in C language | | pRograMMing in Python language | +--------------------------------+ 4 rows in set (0.00 sec)
Following is the query to search a word by the small letter −
mysql> select * from DemoTable where binary Header like '%programming%';
This will produce the following output −
+------------------------------+ | Header | +------------------------------+ | programming in Java language | +------------------------------+ 1 row in set (0.05 sec)
NOTE: If you want to search a word by a capital letter, you need to put the word in LIKE operator.