Msg#: 4225172 posted 4:11 pm on Nov 2, 2010 (gmt 0)
I would expect many to many relationships among the various words, so a synonym of one word maybe a synonym of another word and then the words themselves can be synonyms to other words.
So I would build 2 db tables one to hold each word/synonym along with an identifier and another to assign relationships.
table-1 id word(varchar) id with an autoincrement attribute
table2 id1(int) id2(int) where id1 and id2 are identifiers in table-1
Then setup a couple of rules when setting up table-2 so there id1 != id2 and combinations of id1/id2 are unique.
Then retrieve the rows for the synonym for a given word by getting the id from table 1 for a given word and then picking up the ids from table-2. You could perhaps apply a limit to the query to bring up just a number of synonyms.
You could also add an order field to the second table if you know the priority of combinations.