COLLATE Clause in Various Parts of an SQL Query
COLLATE Clause Precedence
BINARY Operator
Every ``character'' column (that is, a column of type CHAR,
VARCHAR, or TEXT) has a column character set and a column
collation, which may not be null. Column definition syntax now has optional
clauses for specifying the column character set and collation:
column_name {CHAR | VARCHAR | TEXT} (column_length)
[CHARACTER SET character_set_name [COLLATE collation_name]]
Example:
CREATE TABLE Table1 ( column1 VARCHAR(5) CHARACTER SET latin1 COLLATE latin1_german1_ci );
MySQL chooses the column character set and collation thus:
CHARACTER SET X and COLLATE Y were specified, then
character set X and collation Y.
CHARACTER SET X was specified without COLLATE, then
character set X and its default collation.
The CHARACTER SET and COLLATE clauses are standard SQL.