弱实体数据库

Weak entity dbms

我对弱实体的了解是,如果没有强实体,它们就无法存在:-

即必须有一个强实体,弱实体必须从中获取密钥(外键)。

示例:HOTEL(强实体)和 ROOM(弱实体), HOTEL 是强实体,因为他们可以(独立)拥有自己的存在,而 ROOM 是弱实体,因为他们总是需要没有它的 HOTEL(HOTEL)房间不存在。

但是在阅读本书时我遇到了一个声明 "However not every existence dependency results in weak entity type "。例如,一个 DRIVER_LICENCE 实体不能存在,除非它与一个 PERSON 实体相关,即使它有自己的密钥(licence_number) 因此它不是弱实体。

我的问题是一个依赖于强实体的实体如何不能成为一个弱实体?

弱实体的存在不依赖于另一个实体,而是定义为身份依赖于另一个实体。

引自 Peter Chen 1976 年的论文"The Entity-Relationship Model - Toward a Unified View of Data":

...we have two forms of entity relations. If relationships are used for identifying the entities, we shall call it a weak entity relation. If relationships are not used for identifying the entities, we shall call it a regular entity relation. Similarly, we also have two forms of relationship relations. If all entities in the relationship are identified by their own attribute values, we shall call it a regular relationship relation. If some entities in the relationship are identified by other relationships, we shall call it a weak relationship relation. For example, any relationships between DEPENDENT entities and other entities will result in weak relationship relations, since a DEPENDENT entity is identified by its name and its relationship with an EMPLOYEE entity. The distinction between regular (entity/relationship) relations and weak (entity/relationship) relations will be useful in maintaining data integrity.

因此,由自身属性标识的实体称为常规实体,无论它是否可以独立存在或仅与另一个实体相关。

通过与另一个实体的关系来识别的实体必然依赖于它而存在,但反之则不然。如果下雨,地面是湿的,但仅仅因为地面是湿的并不意味着下雨。