
- 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
Can we use “LIKE concat()” in a MySQL query?
Yes, we can do that. Let us first create a table −
mysql> create table DemoTable ( Name varchar(50) ); Query OK, 0 rows affected (0.63 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable values('John'); Query OK, 1 row affected (0.14 sec) mysql> insert into DemoTable values('Adam'); Query OK, 1 row affected (0.18 sec) mysql> insert into DemoTable values('Bob'); Query OK, 1 row affected (0.09 sec) mysql> insert into DemoTable values('Mike'); Query OK, 1 row affected (0.16 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable;
This will produce the following output −
+------+ | Name | +------+ | John | | Adam | | Bob | | Mike | +------+ 4 rows in set (0.00 sec)
Following is the query to use “LIKE concat()” in MySQL −
mysql> select Name from DemoTable where Name LIKE concat('%','o','%');
This will produce the following output −
+------+ | Name | +------+ | John | | Bob | +------+ 2 rows in set (0.03 sec)
- Related Articles
- Can we use LIKE and OR together in MySql?
- Can we use SELECT NULL statement in a MySQL query?
- Can we implement 'LIKE' and ‘IN’ in a single MySQL query?
- Can we use WHERE, AND & OR in a single MySQL query?
- How can we use a MySQL stored function in a database query?
- Use LIKE % to fetch multiple values in a single MySQL query
- Can we combine MySQL IN AND LIKE operators?
- Why in MySQL, we cannot use arithmetic operators like ‘=’, ‘
- Can we use str_replace in MySQL?
- Can we use MySQL GROUP BY clause with multiple columns like MySQL DISTINCT clause is used?
- Use MySQL concat() and lower() effectively
- How can we use group functions with non-group fields in MySQL SELECT query?
- How to use GROUP_CONCAT in CONCAT in MySQL?
- How can we check for NULL in a MySQL query?
- MySQL query to group concat distinct by Id?

Advertisements