如何向数据库中的文本数据添加维度?

发布于 2024-09-18 06:43:17 字数 461 浏览 3 评论 0原文

我在数据库中有一些内容,但现在我需要为内容添加两个维度:语言和阅读水平。使内容变得多维的最佳方法是什么?

例如,这是我的表格:

|-------------|
|    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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

北斗星光 2024-09-25 06:43:22

将等级列和语言列添加到现有的食品表中。

Add a grade column and a language column to your existing Food table.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文