20

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?

Ivantha
  • 491
  • 2
  • 9
  • 27

2 Answers2

45

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).

reaanb
  • 9,806
  • 2
  • 23
  • 37
  • 2
    You always answer my questions. Thank you for taking your time to provide a clear and detailed answer :) – Ivantha Jul 14 '16 at 06:54
  • @reeanb Does having very few associative entities in an ER diagram means an application will not be rich in functionalities ? – Jason Krs Sep 13 '17 at 19:44
  • 1
    @JasonKrs No, a data model only defines what an application can know, not what it can do. – reaanb Sep 14 '17 at 05:43
  • @reaanb Okay. Thanks – Jason Krs Sep 14 '17 at 18:54
  • Isn't the Associative Entity used to resolve the Many-to-Many Relationships? https://www.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. https://books.google.com.bd/books?id=4BuKZ3-RKncC&lpg=PA80&dq=%22Associative%20entities%22%20database&pg=PA80#v=onepage&q&f=false – Shamsul Arefin Mar 30 '21 at 19:57
  • @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](https://doi.org/10.1145/320434.320440) refers to entity relations and relationship relations) and there is no need to "resolve" many-to-many relationships. – reaanb Mar 31 '21 at 14:01
  • @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. – reaanb Mar 31 '21 at 14:01
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.