Re: SOUNDS_LIKE, SOUNDEX

Re: SOUNDS_LIKE, SOUNDEX

am 11.10.2010 23:45:39 von ron.piggott

After looking at the response I tried to make 2 mySQL queries that I need
help with. (I didn't use the PHP functions because I am trying to query
the database for results:

#1:
SELECT `word` FROM `bible_concordance_words` WHERE SOUNDEX('command')
ORDER BY `word` ASC
- There are no results, I don't understand because Commanded, Commander,
Commanding, Commandment, Commandments are all in the datase

#2:
SELECT `word` FROM `bible_concordance_words` WHERE command SOUNDS_LIKE
`word` ORDER BY `word` ASC
- I receive the error:
You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near 'SOUNDS_LIKE
`word` ORDER BY `word` ASC

I think it wants me to specify an actual word, not the `word` column.

Is there a way to tweak either of the syntaxes I have started?

Ron

> Hello, Ron:
>
> I apologize if I was supposed to reply to the list directly, however.. I
> saw no direct way to do so that would also ensure my reply to you.
>
> I believe the functions you are looking for would be :
>
> - levenshtein()
> -
> Calculate Levenshtein distance between two strings
> - metaphone() -
> Calculate the metaphone key of a string
> - similar_text()
> -
> Calculate the similarity between two strings
> - soundex() -
> Calculate the soundex key of a string
>
> You would need to use your word and then run the words you want displayed
> as
> possible matches through this function. Alternatively, SQL also has the
> Soundex function , and MySQL has sound_like, which means you could get the
> possible matches returned through the dataset.
>
> Hope this helps!
>
>
>> ---------- Forwarded message ----------
>> From: "Ron Piggott"
>> To: php-db@lists.php.net
>> Date: Mon, 11 Oct 2010 17:12:17 -0400
>> Subject: "Similar to" searches
>>
>> I am wondering if there is a way to or how you would have mySQL query
>> for
>> similar words in comparison to what the user provided.
>>
>> I have a table which contains only single words. It has two columns:
>>
>> - `reference` int(10) NOT NULL AUTO_INCREMENT,
>> - `word` varchar(100)
>>
>> I am wondering if there is a way to cross reference the word the user
>> has
>> provided to similar words in the database (So I could offer "SEE ALSO:"
>> links).
>>
>> An example: If the word the user has provided is: Forced
>> I would like the mySQL query results to find the words: Forcing, Force
>> and
>> Forces to be the results of the query in the words database.
>>
>> Is there any way of achieving this?
>>
>> Ron
>>
>> The Verse of the Day
>> Encouragement from God's Word
>> www.TheVerseOfTheDay.info
>>
>>
>>
>
>
> --
> "Act only according to that maxim whereby you can at the same time will
> that
> it should become a universal law." - Kant
> "He who learns but does not think, is lost; He who thinks but does not
> learn
> is in great danger." - Confucius
>



The Verse of the Day
Encouragement from God's Word
www.TheVerseOfTheDay.info


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Re: SOUNDS_LIKE, SOUNDEX

am 12.10.2010 01:24:06 von dmagick

On 12/10/10 08:45, Ron Piggott wrote:
> After looking at the response I tried to make 2 mySQL queries that I need
> help with. (I didn't use the PHP functions because I am trying to query
> the database for results:
>
> #1:
> SELECT `word` FROM `bible_concordance_words` WHERE SOUNDEX('command')
> ORDER BY `word` ASC
> - There are no results, I don't understand because Commanded, Commander,
> Commanding, Commandment, Commandments are all in the datase
>
> #2:
> SELECT `word` FROM `bible_concordance_words` WHERE command SOUNDS_LIKE
> `word` ORDER BY `word` ASC
> - I receive the error:
> You have an error in your SQL syntax; check the manual that corresponds to
> your MySQL server version for the right syntax to use near 'SOUNDS_LIKE
> `word` ORDER BY `word` ASC

RTFM?

http://dev.mysql.com/doc/refman/5.0/en/string-functions.html #operator_sounds-like

This stuff isn't that difficult to find.

--
Postgresql & php tutorials
http://www.designmagick.com/


--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php