用于存储包含大量问答类型数据的报告的数据模型

发布于 2024-11-03 10:32:25 字数 515 浏览 0 评论 0原文

我必须设计模型来存储包含许多部分的报告。每个部分包含一组问题和答案以及一些数据表。

我做出了一些设计决策,并想验证我是否走在正确的轨道上:

  1. 我没有存储对数据模型中部分的任何引用。这好吗?或者我应该将文档部分的引用存储在数据库中吗?我想在应用程序级别处理这个问题。
  2. 我将每个问题创建为一列,而不是设计通用的问答模型。事实上,我创建了一个通用的问答模型 - 但决定不使用它,因为需求大多是已知的,并且会有一些最小的变化。问题文本可以由应用程序层处理,只有答案存储在数据库中 - 我需要一些意见来判断我在这里所做的是否是一个好的做法。
  3. 为属性/问题的每个逻辑分组创建一个实体是个好主意吗?我遵循的原则是创建一个用于重复属性组的实体。对于非重复属性,我直接在整个报告实体下创建所有属性,这会导致该实体中存在大量属性。我不确定从数据库设计的角度来看这是好事还是坏事。如果我必须创建实体来存储一组相关的属性,那么我可以只对该实体有一个 FK,它在模型上看起来会更优雅,但涉及到一个连接 - 哪种方法更好,我该如何做决定一个还是另一个?

I have to design the model to store a report which contains many sections. Each section contains a set of questions and answers and a few tables of data.

I have taken a few design decisions and wanted to validate whether I am on the right track:

  1. I have not stored any reference to sections in the data model. Is this good or Should I store the references to document sections in the DB? I thought of handling this at application level.
  2. I have created each question as a column as opposed to designing a generic question and answer model. In fact, I created a generic question and answer model - but decided against using it as the requirements are mostly known and there would be some minimal changes. The question text can be handled by the application layer and only the answers are stored in DB - I need some opinions on whether what I have done here is a good practice.
  3. Is is a good idea to create an entity for each logical grouping of attributes/questions? The principle I follow is to create an entity for repeating groups of attributes. For non-repeating attributes, I am creating all of them directly under overall report entity and it leads to lots of attributes in that entity. I am not sure whether it is a good or bad thing from a DB design perspective. If I have to create entities to store a related group of attributes, then I can just have a FK to that entity and it would look more elegant on the model, but there is a join involved - which approach is better here and how do I decide on one vs the other?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

迟到的我 2024-11-10 10:32:25

这是我所做的。

我设计了一个通用的问题&答案模型可以支持任何报告中的任意数量的问题及其任意组合。

Here is what I have done.

I have designed a generic Question & Answer model which can support any number of questions and any combination of them in any report.

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