MySQL 中的 COLLATION(str) 函数返回字符串参数的排序规则。
COLLATION(str)
str 字符串
(1)演示 COLLATION() 函数的基础用法,如下:
mysql> SELECT COLLATION('abc'); +--------------------+ | COLLATION('abc') | +--------------------+ | utf8mb4_general_ci | +--------------------+ 1 row in set (0.04 sec) mysql> SELECT COLLATION(_utf8'abc'); +-----------------------+ | COLLATION(_utf8'abc') | +-----------------------+ | utf8_general_ci | +-----------------------+ 1 row in set (0.04 sec)