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:
Languages with the fields languageID (primary key) and language.
Terms with the fields termID (primary key), term.
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.
精彩评论