Topic group Related topics Example
Returns a number that represents the phonetic difference between two strings.
The first character expression to evaluate the SOUNDEX( ) of and compare to the second value.
The second character expression to evaluate the SOUNDEX( ) of and compare to the first value.
SOUNDEX( ) returns a four-character code that represents the phonetic value of a character expression. DIFFERENCE( ) compares the SOUNDEX( ) codes of two character expressions, and returns an integer from 0 to 4 that expresses the difference between the codes.
A returned value of 0 indicates the greatest difference in SOUNDEX( ) codes—the two expressions have no SOUNDEX( ) characters in common. A returned value of 4 indicates the least difference—the two expressions have all four SOUNDEX( ) characters in common. However, using DIFFERENCE( ) on short strings can produce unexpected results, as shown in the following example.
? soundex( "Mom" ) // Displays M500
? soundex( "Dad" ) // Displays D300
? difference( "Mom", "Dad" ) // Displays 2
To compare the character-by-character similarity between two strings rather than the phonetic similarity, use LIKE( ).