콘텐츠로 이동

문자열의 Soundex 코드를 생성합니다.

  • Soundex 코드는 문자 하나와 그 뒤에 오는 숫자 세 자리로 구성됩니다. PlaidCloud Lakehouse의 구현은 4자리를 초과하는 숫자를 반환하지만, 결과에 SUBSTR을 적용하면 표준 Soundex 코드를 얻을 수 있습니다.
  • 문자열의 영문자가 아닌 모든 문자는 무시됩니다.
  • A-Z 범위를 벗어나는 국제 문자는 첫 글자가 아니면 모두 무시됩니다.

참고: SOUNDS LIKE

func.soundex(<str>)
func.soundex('PlaidCloud Lakehouse')
┌──────────────────────────────────────┐
│ func.soundex('PlaidCloud Lakehouse') │
├──────────────────────────────────────┤
│ D153 │
└──────────────────────────────────────┘
SOUNDEX(<str>)
인수 설명
str 문자열입니다.

VARCHAR 형식의 코드 또는 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> │
└─────────────────────────────────────┘