开发者

What is the optimal way to make a dictionary database

I have to make a dictionary like databese. It开发者_如何学编程 contains terms and explanations. The explanations are in 2 languages, but the number will increase with time. What is the optimal way to make it? In how much tables should I split the data?


I would use a simple many to many relationship pattern using 3 tables:

  1. Languages with the fields languageID (primary key) and language.

  2. Terms with the fields termID (primary key), term.

  3. Explanations with the fields languageID (foreign key to Languages), termID (foreign key to Terms), and explanation. Make a unique key using the languageID and termID fields.

This will allow languages, terms and explanations to grow independently over time but strongly links each explanation to a single language.


You should only need two tables: one for words and another for definitions. In the definitions table, have a field that stores the id of the word to which it belongs. That way, you can have as many definitions per word as you want.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜