关联实体和关联关系属性有什么区别?在我的一本名为《现代数据库管理》(Hoffer,第11版)的书中,作者陈述了两者之间的区别。然而,它并没有真正解释为什么会有差别,相反,它只是给出了它们是如何不同的例子。
据我所知,一个有一个属性关联的关系是一个关联关系属性,并用一条虚线表示一个圆角矩形,该矩形内有该属性。而关联实体是描述关系的多个属性。两者都只能用于ER图解中的多对多关系。我的思维过程正确吗?
编辑--还有,我忘了提,有了关联实体,它们还有一个属性是唯一的标识符,至少,这是我想的。
关联实体是以多对多关系将其他两个表关联起来的表。
关联关系属性是由于多对多关系而存在的关联实体的属性。
这里有一个例子。假设我们有以下几个表。
User
----
User ID
User Login Name
User Name
User Password
Permission
----------
Permission ID
Permission Name
Permission Description
好的,我们在用户和权限之间有一个多对多的关系。一个用户可以拥有多个权限,并且一个权限可以在多个用户之间共享。
所以,我们创建一个关联实体。
UserPermission
--------------
User ID
Permission ID
Permission Granted Time Stamp
授予的权限时间戳是一个关联关系属性。它既不适合用户表,也不适合权限表。这是关联的一个属性。
在ER图解中,m:n关系可以具有描述该关系的关联实体或单个关联属性。不同的是,关联实体必须有唯一的标识符,而关联属性没有。根据这本书,一个联合实体必须具备:
1-all the relationships for the participating entity types are M:N relationships
2-the resulting associative entity type has independent meaning to the end user and has an identifier
3- the entity has one or more attributes
4-the entity participates in 1 or more relationships independent of the entities related in the associated relationship.