Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When to use Associative entities?

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?

like image 402
Ivantha Avatar asked Jul 14 '16 05:07

Ivantha


People also ask

What is an associative entity and when is it used?

A Business Data Model (BDM) associative entity represents an association between two fundamental entities that has a potential many-to-many cardinality or that holds some attributes.

How are associative entities created?

An associative entity is derived from the BDM associative entities by applying transformation rules based on the data load and the workload. Associative entities allow the grouping together of associations that have the same right and left parent, avoiding changes when new kinds of association are defined.

What role do associative entities play join tables in many-to-many joins?

An associative entity is the table that associates two other tables in a many to many relationship. An associative relationship attribute is an attribute of the associative entity that exists because of the many to many relationship.


1 Answers

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

like image 51
reaanb Avatar answered Sep 28 '22 10:09

reaanb