# `ESCAPE` Characters in `LIKE`

+ Default escape character: **`\`**
+ Change the escape character: **`... LIKE '{pattern}' ESCAPE '{escape_character}'`**
+ For example, what we need are percentages between 90 and 99:
  + **`... LIKE '9_\%'`**

+ Observe the following behaviors, what is going wrong?
```
tidb>  SELECT * FROM test.sample_table WHERE content like '~!@9_%@!~';
+---------+
| content |
+---------+
| 90%     |
| ~!@955@!~     |
| 96%     |
| 98%     |
| 99%     |
| 92%     |
+---------+
6 rows in set (0.00 sec)
```
```
tidb>  SELECT * FROM test.sample_table WHERE content like '~!@9_\%@!~';
+---------+
| content |
+---------+
| 90%     |
| 96%     |
| 98%     |
| 99%     |
| 92%     |
+---------+
5 rows in set (0.01 sec)
```

------------------------------------------------------------
In this example, we don't expect '955' as the correct result.

The correct LIKE clause can be:

```
tidb> select '95%' WHERE '95%' like '9_\%';
+-----+
| 95% |
+-----+
| 95% |
+-----+
1 row in set (0.00 sec)

tidb> select '955' WHERE '955' like '9_\%';
Empty set (0.00 sec)

```

Or:

```
tidb> select '95%' WHERE '95%' like '9_#%' ESCAPE '#';
+-----+
| 95% |
+-----+
| 95% |
+-----+
1 row in set (0.00 sec)

tidb> select '955' WHERE '955' like '9_#%' ESCAPE '#';
Empty set (0.00 sec)

```