When to use Associative entities?

Ivantha picture Ivantha · Jul 14, 2016 · Viewed 18.6k times · Source

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?

Answer

reaanb picture reaanb · Jul 14, 2016

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