Skip to content

Latest commit

 

History

History
53 lines (43 loc) · 2.09 KB

information-schema-collations.md

File metadata and controls

53 lines (43 loc) · 2.09 KB
title summary
COLLATIONS
Learn the `COLLATIONS` information_schema table.

COLLATIONS

The COLLATIONS table provides a list of collations that correspond to character sets in the CHARACTER_SETS table. Currently, this table is included only for compatibility with MySQL.

{{< copyable "sql" >}}

USE information_schema;
DESC collations;
+--------------------+-------------+------+------+---------+-------+
| Field              | Type        | Null | Key  | Default | Extra |
+--------------------+-------------+------+------+---------+-------+
| COLLATION_NAME     | varchar(32) | YES  |      | NULL    |       |
| CHARACTER_SET_NAME | varchar(32) | YES  |      | NULL    |       |
| ID                 | bigint(11)  | YES  |      | NULL    |       |
| IS_DEFAULT         | varchar(3)  | YES  |      | NULL    |       |
| IS_COMPILED        | varchar(3)  | YES  |      | NULL    |       |
| SORTLEN            | bigint(3)   | YES  |      | NULL    |       |
+--------------------+-------------+------+------+---------+-------+
6 rows in set (0.00 sec)

{{< copyable "sql" >}}

SELECT * FROM collations WHERE character_set_name='utf8mb4';
+----------------+--------------------+------+------------+-------------+---------+
| COLLATION_NAME | CHARACTER_SET_NAME | ID   | IS_DEFAULT | IS_COMPILED | SORTLEN |
+----------------+--------------------+------+------------+-------------+---------+
| utf8mb4_bin    | utf8mb4            |   46 | Yes        | Yes         |       1 |
+----------------+--------------------+------+------------+-------------+---------+
1 row in set (0.00 sec)

The description of columns in the COLLATION table is as follows:

  • COLLATION_NAME: The name of the collation.
  • CHARACTER_SET_NAME: The name of the character set which the collation belongs to.
  • ID: The ID of the collation.
  • IS_DEFAULT: Whether this collation is the default collation of the character set it belongs to.
  • IS_COMPILED: Whether the character set is compiled into the server.
  • SORTLEN: The minimum length of memory allocated when the collation sorts characters.