8.3 1:(N) with dependent existence (1对多依赖关系)
原文
Problem description
The normalized data model of an invoicing system indicates that a 1:(N) relationship exists between Invoice Header and Invoice Line. The application allows users to create an Invoice Header first to which lines can be added later on; hence, the optionality. If users decide at a given moment to delete the Invoice Header, the Invoice Lines are also automatically deleted.
How many logical files should be distinguished here?
Discussion
Invoice Header and Invoice Line have a 1:(N) relationship. According to the table in section 4.21.5, the number of logical files is determined based on entity dependence. Because of the business rule that any Invoice Lines linked to the Invoice Header are deleted automatically when the Invoice Header is deleted, we can conclude that Invoice Line is entity dependent with respect to Invoice Header. (See situation 1 in the discussion about (in)dependence in a 1:(N) relationship in section 4.21.5) There is, then, one logical unit called Invoice that contains the entity types Invoice Header and Invoice Line.
Solution
Count one logical file with two record types.
翻译
问题描述
发票系统的规范化数据模型表明,发票标题和发票行之间存在1:(N)关系。该应用程序允许用户首先创建一个发票标题,稍后可以添加行;因此,发票行是可选择性的。如果用户在删除发票标题,发票行也会自动删除。
这里应该区分多少个逻辑文件?
讨论
发票标题和发票行具有1:(N)关系。根据第4.21.5节中的表格,逻辑文件的数量根据实体依赖性确定。由于删除发票标题时,链接到发票标题的任何发票行都会自动删除的业务规则,我们可以得出结论,发票行与发票标题相关。(参见第4.21.5节中关于1:(N)关系中的(in)依赖关系的讨论中的情况1)然后,有一个称为发票的逻辑单元,包含实体类型发票标题和发票行。
结论
识别1个逻辑文件2个记录类型