Difference between revisions of "SOUNDEX"
From MidrangeWiki
m |
(→Overview) |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
− | + | [[Category:SQL]] | |
+ | [[Category:Database]] | ||
+ | ==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. | ||
+ | <pre> | ||
+ | select soundex('FISH'), soundex('FICHE') from QSQPTABL | ||
− | + | SOUNDEX ( 'FISH' ) SOUNDEX ( 'FICHE' ) | |
+ | F200 F200 | ||
+ | </pre> | ||
− | + | ==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]] | ||
+ | <pre> | ||
SELECT fieldname FROM libraryname/filename WHERE SOUNDEX{fieldname) = SOUNDEX('prtsit') ORDER BY fieldname | SELECT fieldname FROM libraryname/filename WHERE SOUNDEX{fieldname) = SOUNDEX('prtsit') ORDER BY fieldname | ||
+ | </pre> |
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