Categories:

String & Binary Functions

COLLATION

Returns the collation specification of the expression.

Syntax

COLLATION(<expression>)

Arguments

expression

The expression for which you want to know the collation specification. Typically, this is a column name.

Returns

Returns a VARCHAR containing the collation specification of the expression.

Examples

This shows how to get the collation specification of a specified column:

First, create the table and insert data:

CREATE TABLE collation1 (v VARCHAR COLLATE 'sp');
INSERT INTO collation1 (v) VALUES ('ñ');

Second, show the collation of the column.

SELECT COLLATION(v)
    FROM collation1;
+--------------+
| COLLATION(V) |
|--------------|
| sp           |
+--------------+