Hello, very good, I am making a class diagram and I have a very important question, I am asked:
Each sporting event is organized by a single entity, although one entity may organize several sporting events. Each entity will be assigned a unique alphanumeric code and you also want to store your name and your web page, if you have one. It may happen that a sporting event has one or several entities that sponsor it, although it is also possible that there are events that do not have a sponsor. On the other hand, an entity may not sponsor any sporting event or may sponsor several.
Well, I am clear that "Event" and "Entity" are related entities but then there is talk of a new entity called "Sponsor" of which no attribute is named but that is related to the "Event" and "Entity" entities. ", the fact is that I don't know whether to enter an associative relationship or a ternary one...
I honestly have many doubts, it has me confused.
All the best!
Chen's ER model is very useful for clarifying these types of questions. What happens is that you have had the bad luck that your organizers and sponsors call
entidades
each other and you link them through relationships, which in the ER model are called that but, in Access, the relationship is another concept (the FK or foreign key). Come on, you have the confusion of names served. And if you also had to launch a stored procedure periodically (which curiously we call an event), then you would already have the perfect storm.Let's go to the ER model:
you only have two entities:
entidades
andeventos
You only have two relationships:
patrocinan
andorganizan
, which are neither the same nor modeled the same. Sponsoring is putting money and organizing implies much more, in addition to the cardinality restriction that you mention.Notice that the entities are nouns and the relationships are verbs; this simplification usually helps a lot.
I'll give it to you in SQL so that you can see how the relationship
organizan
will not need to be implemented as a table, but rather it will be a field ofeventos
.