Skip to content

Generates the Soundex code for a string.

  • A Soundex code consists of a letter followed by three numerical digits. PlaidCloud Lakehouse’s implementation returns more than 4 digits, but you can SUBSTR the result to get a standard Soundex code.
  • All non-alphabetic characters in the string are ignored.
  • All international alphabetic characters outside the A-Z range are ignored unless they’re the first letter.

See also: SOUNDS LIKE

func.soundex(<str>)
func.soundex('PlaidCloud Lakehouse')
┌──────────────────────────────────────┐
│ func.soundex('PlaidCloud Lakehouse') │
├──────────────────────────────────────┤
│ D153 │
└──────────────────────────────────────┘
SOUNDEX(<str>)
ArgumentsDescription
strThe string.

Returns a code of type VARCHAR or a NULL value.

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>
└─────────────────────────────────────┘