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