
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How to search a word by capital or small letter in MySQL?
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.
- Related Articles
- How to search specific word in MySQL with RegExp?
- MySQL query to display all the fields that contain a capital letter?
- MySQL query to search exact word from string?
- How to search a record by date in MySQL table?
- How to search by specific pattern in MySQL?
- ORDER BY a specific word in MySQL
- Capitalize last letter and Lowercase first letter of a word in Java
- MySQL Order by beginning letter?
- How to convert first letter into capital in R data frame column?
- How To Check If The First Letter In A Specific Cell Is Capital In Excel?
- How to convert first letter into capital in data.table object column in R?
- Word Search in Python
- How to capitalize the first letter of each word in a string using JavaScript?
- How to Automatically Increase a Letter by One to Get the Next Letter in Excel?
- How to convert first letter into capital in single column R data frame using a function?

Advertisements