Although there are hundreds of thousands of words out there, I pick only 6 words like the below for simplification.
If a user submits a word "diamond", it shows jewel and gold.Code:diamond drink gold jewel poor wine
If a user submits a word "drink", it shows wine.
If a user submits a word "gold", it shows jewel and diamond.
If a user submits a word "jewel", it shows diamond and gold.
If a user submits a word "poor", it shows nothing.
If a user submits a word "wine", it shows drink.
I am thinking of two ways.
The 1st way has two tables like the below.
The 2nd way has only a table like the below.Code:data in wordTable (id) word (1) diamond (2) drink (3) gold (4) jewel (5) poor (6) wine data in relateTable (word1) word2 (1) 3 (1) 4 (2) 6 (3) 4
I guessCode:data in relateTable (word1) word2 diamond gold diamond jewel drink wine gold jewel
that the 1st way will give smaller burden to DB as the data will grow more and more
and
that the 2nd way will give smaller burden to me because it is more semantic.
(Question1) Which way will be better?
(Question2) Am I on the right track for the purpose?
Do you have another suggestion?
Do you know any web pages relating on this issue?









Bookmarks