考虑一个强大的实体集:
Building(Building_id , Name , Area_occupied , Number_of_floors)
弱实体集:
Room(Room_number , Room_area_occupied , Capacity , Building_id)
在实体集Room中,Building_id是引用Building实体集的主键的外键。建筑物可以有很多房间,显然,一个房间属于一个酒店。
i)中。这是一种构成关系吗?
ⅱ)。如何在ER图中表示组合关系。具体来说,您如何表示ER图中的has-a和has-many关系?
ⅲ)。如果ER图使用菱形来表示关系,那么如果它是一个组合,一个关联等,你怎么看?
答案 0 :(得分:0)
i). "Composition relationship" isn't a formal term in the entity-relationship model. As in your other question, I'll take it to mean a binary relation (a,b)
that is left-total (every a is related to some b) and a->b
(an a is related to just one b).
(Building_id, Room_number) -> Building_id
fulfills this requirement.
Note that my definition is based on your own description in Identifying relationships vs composition relationships? and not necessarily the correct/only definition for has-a relationships.
ii). Based on the preceding definition:
iii). Based on the preceding definition, you would look for total participation (double association line) on one side and functional dependency (cardinality of 1) on the other side of the diamond.
An association would be any relationship between entity sets.