All pages
Powered by GitBook
1 of 1

Loading...

COLLATION

Return the collation of a string. This function outputs the name of the collation rule used for sorting and comparing the string argument.

Syntax

COLLATION(str)

Description

Returns the collation of the string argument. If str is not a string, it is considered as a binary string (so the function returns 'binary'). This applies to NULL, too. The return value is a string in the utf8 .

See .

Examples

See Also

This page is licensed: GPLv2, originally from

character set
Character Sets and Collations
String literals
CAST()
CONVERT()
fill_help_tables.sql
SELECT COLLATION('abc');
+-------------------+
| COLLATION('abc')  |
+-------------------+
| latin1_swedish_ci |
+-------------------+

SELECT COLLATION(_utf8'abc');
+-----------------------+
| COLLATION(_utf8'abc') |
+-----------------------+
| utf8_general_ci       |
+-----------------------+