Com a cláusula COLLATE
você pode
sobrescrever o padrão da collation, qualquer que seja ele, para
comparação. COLLATE
pode ser usada em
várias partes da consulta SQL. Aqui estão alguns exemplos:
Com ORDER BY
:
SELECT k FROM t1 ORDER BY k COLLATE latin1_german2_ci;
Com AS
:
SELECT k COLLATE latin1_german2_ci AS k1 FROM t1 ORDER BY k1;
Com GROUP BY
:
SELECT k FROM t1 GROUP BY k COLLATE latin1_german2_ci;
Com aggregate functions:
SELECT MAX(k COLLATE latin1_german2_ci) FROM t1;
Com DISTINCT
:
SELECT DISTINCT k COLLATE latin1_german2_ci FROM t1;
Com WHERE
:
SELECT * FROM t1 WHERE _latin1 'Müller' COLLATE latin1_german2_ci = k;
Com HAVING
:
SELECT k FROM t1 GROUP BY k HAVING k = _latin1 'Müller' COLLATE latin1_german2_ci;
This is a translation of the MySQL Reference Manual that can be found at dev.mysql.com. The original Reference Manual is in English, and this translation is not necessarily as up to date as the English version.