Aller au contenu

Génère le code Soundex d’une chaîne.

  • Un code Soundex se compose d’une lettre suivie de trois chiffres. L’implémentation de PlaidCloud Lakehouse renvoie plus de 4 chiffres, mais vous pouvez appliquer SUBSTR au résultat pour obtenir un code Soundex standard.
  • Tous les caractères non alphabétiques de la chaîne sont ignorés.
  • Tous les caractères alphabétiques internationaux situés en dehors de la plage A-Z sont ignorés, sauf s’il s’agit de la première lettre.

Voir aussi : SOUNDS LIKE

func.soundex(<str>)
func.soundex('PlaidCloud Lakehouse')
┌──────────────────────────────────────┐
│ func.soundex('PlaidCloud Lakehouse') │
├──────────────────────────────────────┤
│ D153 │
└──────────────────────────────────────┘
SOUNDEX(<str>)
Arguments Description
str La chaîne.

Renvoie un code de type VARCHAR ou une valeur NULL.

SELECT SOUNDEX('PlaidCloud Lakehouse');
---
D153
-- All non-alphabetic characters in the string are ignored.
SELECT SOUNDEX('PlaidCloud Lakehouse!');
---
D153
-- All international alphabetic characters outside the A-Z range are ignored unless they're the first letter.
SELECT SOUNDEX('PlaidCloud Lakehouse,你好');
---
D153
SELECT SOUNDEX('你好,PlaidCloud Lakehouse');
---
你3153
-- SUBSTR the result to get a standard Soundex code.
SELECT SOUNDEX('databend cloud'),SUBSTR(SOUNDEX('databend cloud'),1,4);
soundex('databend cloud')|substring(soundex('databend cloud') from 1 for 4)|
-------------------------+-------------------------------------------------+
D153243 |D153 |
SELECT SOUNDEX(NULL);
┌─────────────────────────────────────┐
│ `SOUNDEX(NULL)` │
├─────────────────────────────────────┤
│ <null> │
└─────────────────────────────────────┘