数据库表设计问题 [英] Database Table design problem

查看:69
本文介绍了数据库表设计问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

场景:
存在 PROCESS 的层次结构。喜欢



PR-2,PR-3是Pr-1的孩子



PR-4,PR-5是PR-2的孩子



叶过程(在我们的情况下PR-3,PR-4和PR-5 可以按照 ACTIVITY



现在, ACTIVITY 只是 PROCESS 但有一些额外的属性,所以



我应该在数据库中创建两个差异表(一个 ACTIVITY PROCESS )?





我应该在 PROCESS 表中添加一些字段(对于 ACTIVITIY 的额外属性),并存储 ACTIVITY PROCESS 表中。



======= ========================== EDITED ===================== =================



其实这里 PROCESS AND ACTIVITY 是参与BPM(Businees流程管理)的人



有BPM知识的人可以找出 ACTIVITY PROCESS 是。



不知道 BPM ,我解释你 PROCESS ACTIVITY PROCESS (如CustomerOrderPlaced,CustomerOrderCancelled等)和 ACTIVIT



因此, ACTIVITY PROCESS 的子级,具有一些额外的属性。



ACTIVITY扩展PROCESS

解决方案

只要你说 ACTIVITY 都像进程的部分 ACTIVITY 扩展 PROCESS 更长的有效语句。这不是一个关系。这是一个有关系。



在ER术语中,Process和Activity之间存在一对多的关系。如果一个活动属于多个进程,则可能是多对多关系。



例如,CustomerPlacesOrder是一个进程。活动是:




  • 客户填充购物车;

  • 客户退房;

  • 客户输入交货和结算信息,必要时进行注册;

  • 工人收到订单;

  • ,工人选择合适的包装容器并填充它;

  • 工人在每日交货时发送。



或者你想要的复杂。继承这不是。


Scenario: There is a hierarchy of PROCESS. Like

PR-2, PR-3 are children of Pr-1,

PR-4, PR-5 are children of PR-2

Now the leaf processes (in our case PR-3, PR-4 and PR-5 can be described in terms of series of ACTIVITY

Now, ACTIVITY is just a child of PROCESS but has some extra attributes, so

Should I make two diff. tables in the database (one for ACTIVITY and one for PROCESS)?

or

Should I add some fields (for extra attributes of ACTIVITIY) in the PROCESS table and store the ACTIVITY in PROCESS table.

=================================== EDITED ======================================

Actually, here PROCESS AND ACTIVITY are the one's that involved in BPM (Businees Process Management)

Those who have knowledge of BPM can figure out what ACTIVITY AND PROCESS are.

Those who don't know BPM, I explain you what I mean by PROCESS and ACTIVITY.

Any enterprise has various PROCESSes (like CustomerOrderPlaced, CustomerOrderCancelled etc.) and ACTIVITies are like parts of a process which are to be performed to complete the process.

So, ACTIVITY is a child of PROCESS with some extra attributes.

Or in terms of Java, ACTIVITY extends PROCESS

解决方案

As soon as you say "ACTIVITY are like parts of a process", "ACTIVITY extends PROCESS" is no longer a valid statement. It's not an is-a relationship. It's a has-a relationship.

In ER terms there is a one-to-many relationship between Process and Activity. Or possibly a many-to-many relationship if one Activity belongs to multiple Processes.

For example, CustomerPlacesOrder is a Process. The Activities are:

  • Customer fills shopping Cart;
  • Customer checks out;
  • Customer enters delivery and billing info, registering if necessary;
  • Worker receives order;
  • If the items are in stock, the Worker selects an appropriate packing container and fills it;
  • Worker send it on the daily deliveries.

Or however complicated you want to get. Inheritance this is not.

这篇关于数据库表设计问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆