ILIKE

Description

The ILIKE operator is used similarly to the LIKE operator to search for a specified pattern in a column in the WHERE clause.

The main difference between the ILIKE operator and the LIKE operator is case sensitivity. When using ILIKE, characters in a string are treated the same whether they are uppercase or lowercase.

Syntax

1. > SELECT column1, column2, ...
2. FROM table_name
3. WHERE columnN ILIKE pattern;

Examples

1. drop table t1;
2. create table t1(a varchar(20));
3. insert into t1 values ('abc'), ('ABC'), ('abC');
4. select * from t1 where a ilike '%abC%';

6. mysql> select * from t1 where a ilike '%abC%';
7. +------+
8. | a    |
9. +------+
10. | abc  |
11. | ABC  |
12. | abC  |
13. +------+
14. 3 rows in set (0.01 sec)