sql - Soundex 函数在 SQL Server 中如何工作?

标签 sql sql-server soundex

以下是 SQL 中的 Soundex 代码示例:

SELECT SOUNDEX('Smith'), SOUNDEX('Smythe');
----- ----- 
S530  S530  

'Smith' 如何变成 S530

在此示例中,第一个数字是 S,因为这是输入表达式中的第一个字符,但是如何计算剩余的三个数字?

最佳答案

看看这个 article

The first letter of the code corresponds to the first letter of the name. The remainder of the code consists of three digits derived from the syllables of the word according to the following code:

  • 1 = B, F, P, V
  • 2 = C, G, J, K, Q, S, X, Z
  • 3 = D, T
  • 4 = L
  • 5 = M,N
  • 6 = R

The double letters with the same Soundex code, A, E, I, O, U, H, W, Y, and some prefixes are being disregarded...

因此,对于 Smith 和 Smythe,代码是这样创建的:

S  S   ->   S
m  m   ->   5
i  y   ->   0
t  t   ->   3
h  h   ->   0
   e   ->   -

关于sql - Soundex 函数在 SQL Server 中如何工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7295812/

相关文章:

sql - SQL 存储过程中的动态排序

sql-server - 更改 SQL Server 连接上的应用程序名称

sql - 每列在单独的行中

mysql - SQL:应用程序跨数据库仅维护一种通用模式

c# - Soundex 算法的一些变化

mysql - 批量插入/更新mysql

mysql - SQL 平衡计算按日期排序

SQL Server Profiler 显示 ObjectType 20816 - PQ

sql - 在 SQL Server 上逐字使用 SOUNDEX()