mysqldata-analysisdata-modelingdatamodelstaruml

How can I describe an associative entity relationship?


So in a one to many relation it can be like:

Director (1..1)--R3--(0..*) Movie R11: A director can direct many movies; a movie only has one director.

But if we have a many to many relation and we use an Associative entity:

Movie (1..1)--R3--(0..)MovieCountry(0..)--R4I--(1..1)Country

It is okay if I put: R1:A movie can be film in many countries. R2:A country can be a location for many movies.

or should I add in some way the Associative entity?


Solution

  • In your example you might have at table of directors and a table of movies with director as a foreign key.
    You could also have a countries table with the name etc and an a county ID in the movies column but if you only want the name of the country it might just be one column in the movies table.
    It is valuable to have a separate table when it avoids having lots of duplicate values. You could put the directors info: dob, adresse, nationalité etc in the movies table, but there would be a lot of duplication.