SQL SOUNDEX Function

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.

Example

#

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'
Result:  1 record
Read Red Lead Pave
R300 R300 L300 P100

The same SOUNDEX value means the specified strings sound very similar or the same.

Syntax

Syntax of the SOUNDEX function.

SOUNDEX(string)

string -- a character expression, variable, or column name.


More Examples

SOUNDEX.

PRODUCT
Id
ProductName
SupplierId
UnitPrice
Package
IsDiscontinued
Problem: List customers, sorted by the SOUNDEX value of their first names.
SELECT SOUNDEX(FirstName) AS Soundex, 
       FirstName, LastName
  FROM Customer 
 ORDER BY SOUNDEX(FirstName)
Result:  91 records
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

You may also like



Guides


vsn 3.1