Monday, January 21, 2013

It Sounds Like...

Imagine a world where everyone had the spelling capability of a High School English teacher... Now snap out of it, because that's slightly delusional. Everybody makes the odd spelling mistake, especially when it comes to names, luckily there's a way in SQL to get around this...

Let's take a name.... Carin for instance can be spelled multiple ways: Carin, Caren, Karin, Karen... So there we see four accepted versions of how we could spell Carin. Now let's say Person X needs to find Carin on a database with a million names, but is unsure of the spelling... The query might look like this...

  
This query returns no results as the name in the database is spelled differently than the user believes, but what if you can get past this problem... We can get past this by making use of SoundEx. SoundEx is a phonetic algorithm for indexing names or records by sound as pronounced in English. Next I will implement this on my query...


Now we have a result because of the way the word sounds, the real-life uses for this may be limited, but should still be useful in some non-unique searches such as the one listed above. 

Credit to Mr. Fanie Reynders for acquainting me with this. 

Cheers...

1 comment: