# Filtering by String Values: `LIKE` Operator

+ **`LIKE`** special characters:
  + **`%`**: Any string of zero or more characters
  + **`_`**: Any single character
+ String literals should use single quotes: Find the name, mass, and diameter of the planets:
  + Planet names that begin with the letter `M`
  + Planet names with `6` letters
  + The second letter is `a`, and the planet name is at least `5` letters in length

```
SELECT name, mass, diameter FROM planets WHERE name ~!@LIKE 'M%'@!~;

SELECT name, mass, diameter FROM planets WHERE name ~!@LIKE '______'@!~;

SELECT name, mass, diameter FROM planets WHERE name ~!@LIKE '_a___%'@!~;
```

------------------------------------------------------------
When using `LIKE` fuzzy matching, the wildcard% prefixed in the lookup string causes the index to be unavailable. The LIKE lookup string in a business statement does not use% as the leading position, or when used in conjunction with other valid constraints.

```
tidb> SELECT name, mass, diameter FROM planets WHERE name LIKE 'M%';
+---------+-------+----------+
| name    | mass  | diameter |
+---------+-------+----------+
| Mercury |  0.33 |  4879.00 |
| Mars    | 0.642 |  6792.00 |
+---------+-------+----------+
2 rows in set (0.01 sec)

tidb> SELECT name, mass, diameter FROM planets WHERE name LIKE '______';
+--------+------+-----------+
| name   | mass | diameter  |
+--------+------+-----------+
| Saturn |  568 | 120536.00 |
| Uranus | 86.8 |  51118.00 |
+--------+------+-----------+
2 rows in set (0.00 sec)

tidb> SELECT name, mass, diameter FROM planets WHERE name LIKE '_a___%';
+--------+------+-----------+
| name   | mass | diameter  |
+--------+------+-----------+
| Earth  | 5.97 |  12756.00 |
| Saturn |  568 | 120536.00 |
+--------+------+-----------+
2 rows in set (0.00 sec)

```
