数据库设计问题:两个表之间的中间表可能会产生太多结果
我必须设计一个数据库来处理表单。
基本上,一份表格需要(恰好)7 个人一一经过。每个人都可以同意或拒绝表格。
如果有人拒绝,链条就会停止,后面的人甚至不会收到有表单的通知。
现在我想到了这三个表:表格、人员和中间的响应。然而,我的第一个解决方案听起来太繁重,因为每个表单最多可以有 7 个响应。
桌子就在我们中间。这意味着每个成功的表单在 RESPONSE 表中都有 7 行。
在这里,我们直接在表单内得到了响应信息。它看起来很丑,但至少让一切都尽可能单一。不好的一面是,我无法跟踪回复日期,但我认为这对此并不重要。
您对此有何看法?我觉得他们都错了,我不知道如何解决。
如果这很重要,我将使用 Oracle 9。
I have to design a database to handle forms.
Basically, a form needs to go through (exactly) 7 people, one by one. Each person can either agree or decline a form.
If one declines, the chain stops and the following people don't even get notified that there is a form.
Right now I have thought of those 3 tables: FORM, PERSON, and RESPONSE inbetween. However, my first solution sounds too heavy because each form could have up to 7 responses.
Here we are with the table inbetween. That means that each successful form has 7 rows in the table RESPONSE.
Here we have the responding information directly inside the form. It looks ugly but at least keeps everything as singular as possible. On the bad side I can't track the response dates, but I don't think it is crucial for that matter.
What is your opinion on this? I feel like both of them are wrong and I don't know how to fix that.
If that matters, I'll be using Oracle 9.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在这两者中,我提倡第一个选项,因为如果业务流程发生变化,它会更加灵活,并且需要(比如说)9 个响应。
如果您担心存储,我预计平均而言它会占用更少的空间与较大表格的单个副本相比,“最多”存储 7 个较小表格的副本。
Of the two, I'd advocate the first option, as it would be more flexible should the business process change, and require (say) 9 responses
If you're worried about storage, I would expect on average it to take less space to store "up to" 7 copies of the smaller form, than a single copy of the larger form.
第一个解决方案似乎更好。
然后你可以通过执行简单的 SQL 来检查是否有人不同意:...WHERE response.isapproved=False。否则你必须检查主表中的所有 7 个字段。
First solution seems better.
THen you can check if it is dissaproved by someone by doing simple SQL: ...WHERE response.isapproved=False. Otherwise you have to check all 7 fields in main table.