Difference between revisions of "SOUNDEX"
From MidrangeWiki
(→Overview) |
|||
(One intermediate revision by the same user not shown) | |||
Line 4: | Line 4: | ||
'''Soundex''' is an algorithm that converts a character string into a four character code consisting of a letter followed by a three-digit number that represents the general sound associated with the remainder of the word. For example, both ''FISH'' and ''FICHE'' return soundex code F200. | '''Soundex''' is an algorithm that converts a character string into a four character code consisting of a letter followed by a three-digit number that represents the general sound associated with the remainder of the word. For example, both ''FISH'' and ''FICHE'' return soundex code F200. | ||
<pre> | <pre> | ||
− | select soundex('FISH'), soundex('FICHE') from QSQPTABL | + | select soundex('FISH'), soundex('FICHE') from QSQPTABL |
SOUNDEX ( 'FISH' ) SOUNDEX ( 'FICHE' ) | SOUNDEX ( 'FISH' ) SOUNDEX ( 'FICHE' ) | ||
F200 F200 | F200 F200 | ||
</pre> | </pre> | ||
+ | |||
==Usage== | ==Usage== | ||
The [[SQL]] function SOUNDEX can be used to find a character string for which the sound is known, but the exact spelling is not. For example, the following searches the file for a name that sounds like '''prtsit''' and returns the name '''Pritchett'''. | The [[SQL]] function SOUNDEX can be used to find a character string for which the sound is known, but the exact spelling is not. For example, the following searches the file for a name that sounds like '''prtsit''' and returns the name '''Pritchett'''. |
Latest revision as of 18:30, 10 August 2007
Overview
Soundex is an algorithm that converts a character string into a four character code consisting of a letter followed by a three-digit number that represents the general sound associated with the remainder of the word. For example, both FISH and FICHE return soundex code F200.
select soundex('FISH'), soundex('FICHE') from QSQPTABL SOUNDEX ( 'FISH' ) SOUNDEX ( 'FICHE' ) F200 F200
Usage
The SQL function SOUNDEX can be used to find a character string for which the sound is known, but the exact spelling is not. For example, the following searches the file for a name that sounds like prtsit and returns the name Pritchett.
From Command Line or equivalent STRSQL
SELECT fieldname FROM libraryname/filename WHERE SOUNDEX{fieldname) = SOUNDEX('prtsit') ORDER BY fieldname