# Collate Clause

__*COLLATE Clause*__

```9
tidb> select * from test.c1 order by name;
+------+
| name |
+------+
| A    |
| B    |
| C    |
| a    |
| b    |
| c    |
+------+
6 rows in set (0.00 sec)

tidb> select * from test.c1 order by name ~!@collate utf8mb4_unicode_ci@!~;
+------+
| name |
+------+
| A    |
| a    |
| B    |
| b    |
| C    |
| c    |
+------+
6 rows in set (0.01 sec)
```

------------------------------------------------------------
The following example is taken from the official documentation: `https://docs.pingcap.com/zh/tidb/v6.0/character-set-and-collation` :

```
tidb> SET NAMES utf8mb4 COLLATE utf8mb4_bin;
Query OK, 0 rows affected (0.00 sec)

tidb> SELECT 'A' = 'a';
+-----------+
| 'A' = 'a' |
+-----------+
|         0 |
+-----------+
1 row in set (0.00 sec)

tidb> SET NAMES utf8mb4 COLLATE utf8mb4_general_ci;
Query OK, 0 rows affected (0.00 sec)

tidb> SELECT 'A' = 'a';
+-----------+
| 'A' = 'a' |
+-----------+
|         1 |
+-----------+
1 row in set (0.01 sec)
```
