# soundex

Returns the four-character Soundex code for a string.

Pinot returns `0000` for the empty string. If the input is `null`, Pinot returns `null`.

## Signature

> soundex(string) -> string

## Usage Examples

```sql
SELECT soundex('Robert') AS value
FROM ignoreMe
```

| value |
| ----- |
| R163  |

```sql
SELECT soundex('Rupert') AS value
FROM ignoreMe
```

| value |
| ----- |
| R163  |

```sql
SELECT soundex('Ashcraft') AS value
FROM ignoreMe
```

| value |
| ----- |
| A261  |

```sql
SELECT soundex('') AS value
FROM ignoreMe
```

| value |
| ----- |
| 0000  |

## Notes

* `soundex('Robert')` and `soundex('Rupert')` return the same code because the function is designed for phonetic matching.
* Pinot derives this behavior from `StringFunctions.soundex(...)` in `apache/pinot` merge commit `51e610d486bf8aadd647b4b69f34e9c70ef0ebea`.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pinot.apache.org/functions/string/soundex.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
