受 UI 需求影响的数据库设计:我应该创建额外的字段还是新的关系?

发布于 2024-10-08 19:47:46 字数 360 浏览 0 评论 0原文

我有这样的关系:

1 个事件报告有 N 个文档。事件报告可以有一个由 PupilID 支持的 PupilName 字段。

或者

我可以将设计更改为:

1 个学生有 N 个事件报告等...

我担心的是,我不喜欢额外的表,因为在我的 GUI 中,我使用了一个简单的分组

DataGrid 来记录事件报告。当我现在仍然有一个学生实体时,只是为了

在分组标题中显示学生名称...以及数据行中下面的事件报告。当然

这是不可能的,因为我无法在 DataGrid 中显示 1:N 关系!

你会怎么办?

I have this relation:

1 Incident Report has N Documents. The Incident Report could have a field like PupilName backed by a PupilID.

OR

I could change the design to:

1 Pupil has N Incident Reports etc...

My concern is that I do not like the extra table because in my GUI I used a simple grouped

DataGrid for the Incident Reports. When I have now still a Pupil Entity just to display the

PupilsName in the grouped Header...and the Incident Reports below in the Datarow. Of course

that would not be possible as I can not display a 1:N relation in a DataGrid!

What would you do?

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

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

发布评论

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

评论(1

椵侞 2024-10-15 19:47:46

丽莎,我认为这个问题没有设计问题。

 Pupil               IncidentReport               Document
+---------+         +------------------+         +------------------+
| PupilID |         | IncidentReportID |         | DocumentID       |
+---------+         +------------------+         +------------------+
| Name    | -|---<- | PupilID          | -|---<- | IncidentReportID |
| ...     |         | ...              |         | ...              |
+---------+         +------------------+         +------------------+

虽然我可能不太明白这个问题。

Lisa, I see no design problems in the question.

 Pupil               IncidentReport               Document
+---------+         +------------------+         +------------------+
| PupilID |         | IncidentReportID |         | DocumentID       |
+---------+         +------------------+         +------------------+
| Name    | -|---<- | PupilID          | -|---<- | IncidentReportID |
| ...     |         | ...              |         | ...              |
+---------+         +------------------+         +------------------+

Although I may not quite understand the question.

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