Skip to main content
Returns the Soundex code for a string. Soundex is a phonetic algorithm that indexes names by sound, as pronounced in English. The algorithm produces a four-character code consisting of a letter followed by three digits.
Non-alphabetic characters are ignored when generating the Soundex code. If the input string contains no alphabetic characters, SOUNDEX returns an empty string.

Syntax

SOUNDEX(<expression>)

Parameters

ParameterDescriptionSupported input types
<expression>The string for which to generate the Soundex code.TEXT

Return Type

TEXT

Examples

The following example generates Soundex codes for different variations of a name:
SELECT SOUNDEX('Smith') AS soundex_smith, SOUNDEX('Smyth') AS soundex_smyth, SOUNDEX('SMITH') AS soundex_upper;
soundex_smith textsoundex_smyth textsoundex_upper text
S530S530S530

Rows: 1Execution time: 6.09ms

The following example shows the behavior with strings containing no alphabetic characters:
SELECT SOUNDEX('123') AS soundex_numbers, SOUNDEX('!@#$') AS soundex_symbols, SOUNDEX('') AS soundex_empty;
soundex_numbers textsoundex_symbols textsoundex_empty text

Rows: 1Execution time: 6.15ms