> ## Documentation Index
> Fetch the complete documentation index at: https://docs.firebolt.io/llms.txt
> Use this file to discover all available pages before exploring further.

> Reference material for SOUNDEX function

# SOUNDEX

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.

<Note>
  Non-alphabetic characters are ignored when generating the Soundex code. If the input string contains no alphabetic characters, SOUNDEX returns an empty string.
</Note>

## Syntax

```sql theme={"theme":{"light":"css-variables","dark":"css-variables"}}
SOUNDEX(<expression>)
```

## Parameters

| Parameter      | Description                                        | Supported 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:

<div className="query-window">
  ```
  SELECT SOUNDEX('Smith') AS soundex_smith, SOUNDEX('Smyth') AS soundex_smyth, SOUNDEX('SMITH') AS soundex_upper;
  ```

  | soundex\_smith <span>text</span> | soundex\_smyth <span>text</span> | soundex\_upper <span>text</span> |
  | :------------------------------- | :------------------------------- | :------------------------------- |
  | S530                             | S530                             | S530                             |

  <p><span>Rows: 1</span><span>Execution time: 6.09ms</span></p>
</div>

The following example shows the behavior with strings containing no alphabetic characters:

<div className="query-window">
  ```
  SELECT SOUNDEX('123') AS soundex_numbers, SOUNDEX('!@#$') AS soundex_symbols, SOUNDEX('') AS soundex_empty;
  ```

  | soundex\_numbers <span>text</span> | soundex\_symbols <span>text</span> | soundex\_empty <span>text</span> |
  | :--------------------------------- | :--------------------------------- | :------------------------------- |
  |                                    |                                    |                                  |

  <p><span>Rows: 1</span><span>Execution time: 6.15ms</span></p>
</div>
