DIFFERENCE function [String]

Function

Compares two strings, evaluates the similarity between them, and returns a value from 0 to 4. The best match is 4.

Syntax

DIFFERENCE ( string-expression1, string-expression2 )

Parameters

string-expression1 The first string to compare.

string-expression2 The second string to compare.

Examples

Example 1

The following statement returns the value 4:

SELECT DIFFERENCE( 'Smith', 'Smith' ) FROM iq_dummy

Example 2

The following statement returns the value 4:

SELECT DIFFERENCE( 'Smith', 'Smyth' ) FROM iq_dummy

Example 3

The following statement returns the value 3:

SELECT DIFFERENCE( 'Smith', 'Sweeney' ) FROM iq_dummy

Example 4

The following statement returns the value 2:

SELECT DIFFERENCE( 'Smith', 'Jones' ) FROM iq_dummy

Example 5

The following statement returns the value 1:

SELECT DIFFERENCE( 'Smith', 'Rubin' ) FROM iq_dummy

Example 6

The following statement returns the value 0:

SELECT DIFFERENCE( 'Smith', 'Wilkins' ) FROM iq_dummy

Standards and compatibility

See also

“SOUNDEX function [String]”