- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How can I search (case-insensitive) in a column using LIKE wildcard?
We can do this with the help of lower() with column name. Firstly, we will create a table with the help of CREATE command.
Creating a table −
mysql> CREATE table InCaseSensDemo -> ( -> Name varchar(100) -> ); Query OK, 0 rows affected (0.50 sec)
Inserting records into the table with the help of INSERT command −
mysql> INSERT into InCaseSensDemo values('JOhN'); Query OK, 1 row affected (0.11 sec) mysql> INSERT into InCaseSensDemo values('bob'); Query OK, 1 row affected (0.21 sec) mysql> INSERT into InCaseSensDemo values('BoB'); Query OK, 1 row affected (0.13 sec) mysql> INSERT into InCaseSensDemo values('Bob'); Query OK, 1 row affected (0.18 sec)
Displaying all the records with the help of SELECT command −
mysql> SELECT * from InCaseSensDemo;
The following is the output −
+------+ | Name | +------+ | JOhN | | bob | | BoB | | Bob | +------+ 4 rows in set (0.00 sec)
The syntax to compare case sensitive string in MySQL is as follows −
SELECT * FROM yourTableName WHERE BINARY column_name = 'value';
Now, I am applying the above query to get the result for case sensitive value −
mysql> SELECT * FROM InCaseSensDemo WHERE BINARY Name = 'bob';
The following is the output −
+------+ | Name | +------+ | JOhN | +------+ 1 row in set (0.00 sec)
- Related Articles
- Case insensitive search in Mongo?
- MongoDB $regex operator i or I for case insensitive search
- How to perform case-insensitive search in Oracle?
- MongoDB query with case insensitive search?
- How to achieve case sensitive uniqueness and case insensitive search in MySQL?
- MongoDB query for specific case insensitive search
- How do I do a case insensitive string comparison in Python?
- How do I make case-insensitive queries on MongoDB?
- How do I make my string comparison case insensitive?
- Perform case insensitive SELECT using MySQL IN()?
- How to search for files using the wildcard character (*) in PowerShell?
- How to use case-insensitive switch-case in JavaScript?
- Case-insensitive string replacement using Python Program
- How to make a case-insensitive query in MongoDB?
- Case-insensitive Dictionary in C#

Advertisements