# **LIKE**

## **Grammar Description**

The LIKE operator is used to search for specified patterns in columns in the `WHERE` clause.

There are two wildcards that are often used with the `LIKE` operator:

- Percent sign `%` wildcard: means matching any character sequence (including empty character sequence).

    + %text: Matches a string ending with "text".
    + text%: Matches a string starting with "text".
    + %text%: Matches the string containing "text".

- Underscore `_` wildcard: means matching a single character.

    + `te_t`: Can match "text", "test", etc.

- Other characters: The `LIKE` operator is case sensitive to other characters.

## **Grammar Structure**

```sql
SELECT column1, column2, ...
FROM table_name
WHERE columnN LIKE pattern;
```

## **Example**

```text
drop table t1;
create table t1(a varchar(20));
insert into t1 values ('abc'), ('ABC'), ('abC');
select * from t1 where a like '%abC%';

mysql> select * from t1 where a like '%abC%';
+------+
| a |
+------+
| abC |
+------+
1 row in set (0.00 sec)
```
