What is the difference of partiality and optionality when drawing ER diagrams

前端 未结 1 1732
悲&欢浪女
悲&欢浪女 2021-01-24 20:55

Partial relationships are shown by single lines total relationships are shown by double lines. And in some ER diagrams optional and mandatory relationship is shown by a dotted l

1条回答
  •  伪装坚强ぢ
    2021-01-24 21:28

    Consider the following example:

    A Patient or a Laboratory may exist independently of any relationship. Some Patients may Purchase Medicine, and some Laboratories may Produce Medicine, hence those entity sets participate partially in their relationships.

    Medicine cannot exist without being Produced by a Laboratory, thus Medicine participate totally in the Produced relationship. Medicine can exist without being Purchased hence Medicine participate partially in the Purchase relationship.

    A Patient may Purchase some Medicine without a Prescription, thus a Prescription is optional to the Buys relationship. In contrast, a Purchase cannot exist without a Patient and Medicine, hence those roles are mandatory to the relationship. In the Produced relationship, both roles are mandatory.

    The basic difference here is that cardinality constrains the existence of relationships, while participation constrains the existence of entities. When a role in a relationship set is mandatory, it means a relationship instance can't exist without an entity filling that role. When an entity set participates totally in a relationship, it means an entity can't exist without being related.

    0 讨论(0)
提交回复
热议问题