I MariaDB kan du bruge SHOW COLLATION
administrativ SQL-sætning for at returnere alle tilgængelige sorteringer i MariaDB.
Syntaks
Syntaksen ser sådan ud:
SHOW COLLATION [LIKE 'pattern' | WHERE expr]
Der er mange sorteringer, så det hjælper at bruge LIKE
og/eller Hvor
klausuler, når du har en idé om den undergruppe af kollationer, du leder efter.
Eksempler
Her er nogle eksempler til demonstration.
LIKE
Klausul
Her er et eksempel, der bruger LIKE
klausul for at returnere alle sammenstillinger, der starter med latinsk
:
SHOW COLLATION LIKE 'latin%';
Resultat:
+-------------------------+---------+------+---------+----------+---------+ | Collation | Charset | Id | Default | Compiled | Sortlen | +-------------------------+---------+------+---------+----------+---------+ | latin1_german1_ci | latin1 | 5 | | Yes | 1 | | latin1_swedish_ci | latin1 | 8 | Yes | Yes | 1 | | latin1_danish_ci | latin1 | 15 | | Yes | 1 | | latin1_german2_ci | latin1 | 31 | | Yes | 2 | | latin1_bin | latin1 | 47 | | Yes | 1 | | latin1_general_ci | latin1 | 48 | | Yes | 1 | | latin1_general_cs | latin1 | 49 | | Yes | 1 | | latin1_spanish_ci | latin1 | 94 | | Yes | 1 | | latin1_swedish_nopad_ci | latin1 | 1032 | | Yes | 1 | | latin1_nopad_bin | latin1 | 1071 | | Yes | 1 | | latin2_czech_cs | latin2 | 2 | | Yes | 4 | | latin2_general_ci | latin2 | 9 | Yes | Yes | 1 | | latin2_hungarian_ci | latin2 | 21 | | Yes | 1 | | latin2_croatian_ci | latin2 | 27 | | Yes | 1 | | latin2_bin | latin2 | 77 | | Yes | 1 | | latin2_general_nopad_ci | latin2 | 1033 | | Yes | 1 | | latin2_nopad_bin | latin2 | 1101 | | Yes | 1 | | latin5_turkish_ci | latin5 | 30 | Yes | Yes | 1 | | latin5_bin | latin5 | 78 | | Yes | 1 | | latin5_turkish_nopad_ci | latin5 | 1054 | | Yes | 1 | | latin5_nopad_bin | latin5 | 1102 | | Yes | 1 | | latin7_estonian_cs | latin7 | 20 | | Yes | 1 | | latin7_general_ci | latin7 | 41 | Yes | Yes | 1 | | latin7_general_cs | latin7 | 42 | | Yes | 1 | | latin7_bin | latin7 | 79 | | Yes | 1 | | latin7_general_nopad_ci | latin7 | 1065 | | Yes | 1 | | latin7_nopad_bin | latin7 | 1103 | | Yes | 1 | +-------------------------+---------+------+---------+----------+---------+
HVOR Klausul
Her er et eksempel, der bruger WHERE
klausul for at returnere alle sammenstillinger med en Sortlen
af 2
:
SHOW COLLATION WHERE Sortlen LIKE '2';
Resultat:
+-------------------+---------+----+---------+----------+---------+ | Collation | Charset | Id | Default | Compiled | Sortlen | +-------------------+---------+----+---------+----------+---------+ | latin1_german2_ci | latin1 | 31 | | Yes | 2 | | cp1250_czech_cs | cp1250 | 34 | | Yes | 2 | +-------------------+---------+----+---------+----------+---------+
AND
Søgeord
Vi kan kombinere betingelser med AND
søgeord:
SHOW COLLATION
WHERE Sortlen LIKE '4'
AND Collation LIKE 'utf%';
Resultat:
+---------------------+---------+-----+---------+----------+---------+ | Collation | Charset | Id | Default | Compiled | Sortlen | +---------------------+---------+-----+---------+----------+---------+ | utf8_thai_520_w2 | utf8 | 578 | | Yes | 4 | | utf8mb4_thai_520_w2 | utf8mb4 | 610 | | Yes | 4 | | utf16_thai_520_w2 | utf16 | 674 | | Yes | 4 | | utf32_thai_520_w2 | utf32 | 738 | | Yes | 4 | +---------------------+---------+-----+---------+----------+---------+
Returner alle sorteringer
For at returnere alle sammenstillinger skal du blot fjerne alle klausuler:
SHOW COLLATION;
Se den fulde liste over understøttede sorteringer i MariaDB for resultatet.