What is the difference between Associative Entity and the Intermediate Table of relationships N for N?

Asked

Viewed 13,959 times

3

What’s the difference between Associative Entity and the Intermediate relationship table N to N? Is there any notable difference in the model translation ER to the relational model?

In the ER model the associative entities are represented by a rectangle around the relationship. And the relationships N for N are not.

Relationship N para N Relacionamento N pra N

Associative Entity Entidade Associativa

2 answers

4

The intermediate relationship table N to N is the table generated in the conceptual-logical mapping of cardinalities N to N. Every relationship N:N generates a table in the mapping.

The Associative Entity is when the relationship with cardinality N:N between two entities needs to relate to a third entity. In such cases, this relationship would need to be connected to some graphic representation (or to an entity or relationship). If it is in the entities, the bonds are lost and if it is in the relationship, the modeling would be wrong because it is not possible that two relationships are connected to each other. For this, the rectangle is made around the relationship. Let’s take an example:

MER Acadêmico

If we try to connect the entity DISCIPLINE in the entity STUDENT, we would lose the information of which course it is part. If we call in the COURSE, we would lose the information of which student did the course. If we call in the direct relationship, we would have a modeling error. For this, an associative entity is used. In conceptual-logical mapping, the associative entity is a table as in the relationship with cardinality N:N, but its primary key may go to another table as a foreign key.

3

In the associative entity, also called aggregation, imagine you want to know if the medicine that the doctor prescribed for the patient in any consultation needs a prescription (a flag on the drug entity). Relating the entity Medicament as the entity Medical or with Patient does not make sense, since the issue of prescription refers to the consultation performed. Therefore, the Medicine entity must relate to Consultation. Already the intermediate tables usually contain only two columns that act as a link between the two main tables, as is the case between Engineer and Project.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.