COLLATE
Clause in Various Parts of an SQL Query
COLLATE
Clause Precedence
BINARY
Operator
BINARY
Operator
The BINARY
operator is a shorthand for a COLLATE
clause. For
example, BINARY 'x'
is equivalent to 'x' COLLATE y
, where
y
is the
name of an appropriate binary collation. For example, assuming that
column a
is of character set latin1
, these two queries have the
same effect:
SELECT * FROM t1 ORDER BY BINARY a; SELECT * FROM t1 ORDER BY a COLLATE latin1_bin;
Note: Every character set has a binary collation.