Difference between revisions of "SOUNDEX"

From MidrangeWiki
Jump to: navigation, search
m
Line 1: Line 1:
 
[[Category:SQL]]
 
[[Category:SQL]]
 
[[Category:Database]]
 
[[Category:Database]]
The [[SQL]] function SOUNDEX can 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'''.
+
==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 
  
From Command Line or equivalent
+
SOUNDEX ( 'FISH' )  SOUNDEX ( 'FICHE' )
 
+
      F200                F200       
[[STRSQL]]
+
</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>

Revision as of 13: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