When to use Associative entities?
Asked Answered
K

2

22

Suppose there are two entities called Employee and Campaign. One employee can work on many campaigns. And one campaign can have many employees. I already know this is a many to many relationship.

And when drawing the ER diagram (in Chen notation), the relationship is symbolized by a diamond shape. But there is a separate symbol for associative entities, which symbolizes a many to many relationship between two entities.

1) So should I use the diamond shape or the associative entity shape (diamond inside a square) when drawing many to many relationships in er diagram in Chen's notation?
2) Do they both mean the same thing or different things?
3) If they are two separate things, how can I identify when to use which?

Karelian answered 14/7, 2016 at 5:55 Comment(0)
P
47

Associative entities are used when you need a relationship to be involved in a relationship.

For example:

Enrollment relationship ERD

For a normal many-to-many relationship between Student and Course, we would use just a diamond. However, if we want to associate Enrollment with Teacher, we can turn Enrollment into an associative entity.

Enrollment associative entity ERD

Phyiscally, our database looks like this:

Enrollment associative entity tables

Making Enrollment a ternary relationship in which the Teacher is an optional role would have much the same meaning (except it would be denormalized, having a nullable role).

Pencil answered 14/7, 2016 at 6:45 Comment(7)
You always answer my questions. Thank you for taking your time to provide a clear and detailed answer :)Karelian
@reeanb Does having very few associative entities in an ER diagram means an application will not be rich in functionalities ?Mastectomy
@JasonKrs No, a data model only defines what an application can know, not what it can do.Pencil
@Pencil Okay. ThanksMastectomy
Isn't the Associative Entity used to resolve the Many-to-Many Relationships? sciencedirect.com/topics/computer-science/associative-entity Yes you answer is oviously correct. But I think the primary foucs of Associative Entity is to resolve the Many-to-Many Relationships. books.google.com.bd/…Asmodeus
@ShamsulArefin The notion that a relationship needs to be "resolved" via the creation of an artificial entity between the two kernel entities originated in models of data in which only entity had attributes and relationships were mere binary associations (e.g. the network data model). Chen based his entity-relationship model on the relational model of data and represented both entity types and relationships as logical relations (his paper refers to entity relations and relationship relations) and there is no need to "resolve" many-to-many relationships.Pencil
@ShamsulArefin In practice it's common to denormalize one-to-many relationship relations into the entity relations on the many side, leaving only many-to-many binary (as well as ternary and higher arity relationship) to be represented via their own tables, which ends up looking similar to the network data model perspective. However, my answers to entity-relationship questions are based in Chen's concepts and terminology.Pencil
I
1

An associative entity is used to implement many to many relationship between two or more entities. This entity is composed of primary key of the each to be connected. The composite entity in the Chen model is represented by diamond shape within a rectangle.

Ingold answered 3/3, 2021 at 6:54 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.