The Information Schema CHARACTER_SETS table contains a list of supported character sets, their default collations and maximum lengths.

It contains the following columns:

ColumnDescription
CHARACTER_SET_NAMEName of the character set
DEFAULT_COLLATE_NAMEDefault collation used
DESCRIPTIONCharacter set description
MAXLENMaximum length

The SHOW CHARACTER SET statement returns the same results (although in a different order), and both can be refined in the same way. For example, the following two statements return the same results:

SHOW CHARACTER SET WHERE Maxlen LIKE '2';

and

SELECT * FROM INFORMATION_SCHEMA.CHARACTER_SETS WHERE MAXLEN LIKE '2';

See Setting Character Sets and Collations for details on specifying the character set at the server, database, table and column levels, and Supported Character Sets and Collations for a full list of supported characters sets and collations.

Example

SELECT CHARACTER_SET_NAME FROM INFORMATION_SCHEMA.CHARACTER_SETS 
  WHERE DEFAULT_COLLATE_NAME LIKE '%chinese%';
+--------------------+
| CHARACTER_SET_NAME |
+--------------------+
| big5               |
| gb2312             |
| gbk                |
+--------------------+

Comments

Comments loading...