DuckDB Documentation
SELECT * FROM names, other_names WHERE names.name=other_names.name;
-- ERROR: Cannot combine types with different collation!
-- need to manually overwrite the collation!
SELECT * FROM names, other_names WHERE names.name COLLATE
NOACCENT.NOCASE=other_names.name COLLATE NOACCENT.NOCASE;
-- hännes|HÄNNES
ICU Collations
The collations we have seen so far are not region‑dependent, and do not follow any specific regional
rules. If you wish to follow the rules of a specific region or language, you will need to use one of the
ICU collations. For that, you need to load the ICU extension.
If you are using the C++ API, you may find the extension in the extension/icufolder of the DuckDB
project. Using the C++ API, the extension can be loaded as follows:
DuckDB db;
db.LoadExtension<ICUExtension>();
Loading this extension will add a number of language and region specific collations to your database.
These can be queried using PRAGMA collations command, or by querying the pragma_
collations function.
PRAGMA collations;
SELECT * FROM pragma_collations();
-- [af, am, ar, as, az, be, bg, bn, bo, bs, bs, ca, ceb, chr, cs, cy, da,
de, de_AT, dsb, dz, ee, el, en, en_US, en_US, eo, es, et, fa, fa_AF, fi,
fil, fo, fr, fr_CA, ga, gl, gu, ha, haw, he, he_IL, hi, hr, hsb, hu, hy,
id, id_ID, ig, is, it, ja, ka, kk, kl, km, kn, ko, kok, ku, ky, lb, lkt,
ln, lo, lt, lv, mk, ml, mn, mr, ms, mt, my, nb, nb_NO, ne, nl, nn, om,
or, pa, pa, pa_IN, pl, ps, pt, ro, ru, se, si, sk, sl, smn, sq, sr, sr,
sr_BA, sr_ME, sr_RS, sr, sr_BA, sr_RS, sv, sw, ta, te, th, tk, to, tr,
ug, uk, ur, uz, vi, wae, wo, xh, yi, yo, zh, zh, zh_CN, zh_SG, zh, zh_
HK, zh_MO, zh_TW, zu]
These collations can then be used as the other collations would be used before. They can also be
combined with the NOCASE collation. For example, to use the German collation rules you could use
the following code snippet:
CREATE TABLE strings(s VARCHAR COLLATE DE);
551