如何向数据库中的文本数据添加维度?
我在数据库中有一些内容,但现在我需要为内容添加两个维度:语言和阅读水平。使内容变得多维的最佳方法是什么?
例如,这是我的表格:
|-------------|
| Food |
|-------------|
| id |
| name |
| description |
| ... |
|-------------|
现在我需要在多个阅读级别(例如三年级、七年级、十年级)以及几种不同的语言(例如英语、英式英语、西班牙语和法语)。因此,例如,我需要在所有阅读级别上提供英语内容,以及在所有阅读级别上使用西班牙语内容等。)一个问题是矩阵可能没有完全填充(即,我可能没有一些食物的三年级西班牙语版本),因此设计需要使应用程序易于处理(例如,回退到确实存在的数据版本)。 (简单意味着很少的数据库调用和最少的工作)
什么样的模式可以让我干净地建模?
I have some content in a database, but now I need to add two more dimensions to the content: Language and Reading Level. What is the best way to make content multidimensional?
For example, here's the table I have:
|-------------|
| Food |
|-------------|
| id |
| name |
| description |
| ... |
|-------------|
and now I need to have the same content at multiple reading levels (eg. 3rd grade, 7th grade, 10th grade) and also in a couple different languages (eg. English, British-English, Spanish, and French). So, for example, I will need to have the content in English at all reading levels, as well as in Spanish at all reading levels, etc.) One catch is that the matrix may not be completely filled (ie. I may not have a 3rd grade Spanish version for some foods) so the design needs to make this easy to handle (like, fall back to a version of the data that does exist) for an application. (easy meaning few DB calls and minimal work)
What sort of schema will let me cleanly model this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将等级列和语言列添加到现有的食品表中。
Add a grade column and a language column to your existing Food table.