SOUNDEX returns the SOUNDEX value for a specified string.
This value is a 4-char code representing how a string sounds in spoken English.
The DIFFERENCE function compares the SOUNDEX values of 2 strings.
This example returns the SOUNDEX values for the input strings.
SELECT SOUNDEX('Read') AS 'Read',
SOUNDEX('Red') AS 'Red',
SOUNDEX('Lead') AS 'Lead',
SOUNDEX('Pave') AS 'Pave'
| Read | Red | Lead | Pave |
|---|---|---|---|
| R300 | R300 | L300 | P100 |
The same SOUNDEX value means the specified strings sound very similar or the same.
Syntax of the SOUNDEX function.
SOUNDEX(string)
string -- a character expression, variable, or column name.
| PRODUCT |
|---|
| Id |
| ProductName |
| SupplierId |
| UnitPrice |
| Package |
| IsDiscontinued |
SELECT SOUNDEX(FirstName) AS Soundex,
FirstName, LastName
FROM Customer
ORDER BY SOUNDEX(FirstName)
| Soundex | FirstName | LastName |
|---|---|---|
| A425 | Alejandra | Camino |
| A425 | Alexander | Feuer |
| A500 | Ann | Devon |
| A500 | Ana | Trujillo |
| A514 | Anabela | Domingues |
| A530 | Annette | Roulet |
| A535 | Antonio | Moreno |
| A536 | André | Fonseca |
| A600 | Aria | Cruz |
| A630 | Art | Braunschweiger |
| B656 | Bernardo | Batista |
![]() |
||