databasedata-modelingcardinality

What is the difference between Max Cardinality and Min Cardinality?


I am having a hard time understanding what is the difference between the Max and Min cardinalities when trying to design a database.


Solution

  • Remember cardinality is always a relationship to another thing.

    Max Cardinality (Cardinality) Always 1 or Many. Class A has a relationship to Package B with cardinality of one, that means at most there can be one occurrence of this class in the package. The opposite could be a Package has a Max Cardinality of N, which would mean there can be N number of classes

    Min Cardinality (Optionality) Simply means "required." It's always 0 or 1. 0 would mean 0 or more, 1 or more

    There are tons of good articles out there that explain this, including some that explain how to even property "diagram". Another thing you can search for is Cardinality/Optionality (OMG Terms) which explains the same thing, Optionality is "Min" Cardinality is "Max",


    From http://www.databasecentral.info/FAQ.htm

    Q: I can see how maximum cardinality is used when creating relationships between data tables. However, I don't see how minimal cardinality applies to database design. What am I missing?

    A: You are correct in noticing that maximum cardinality is a more important characteristic of a relationship than minimum cardinality is. All minimum cardinality tells you is the minimum allowed number of rows a table must have in order for the relationship to be meaningful. For example, a basketball TEAM must have at least five PLAYERS, or it is not a basketball team. Thus the minimum cardinality on the PLAYER side is five and the minimum cardinality on the TEAM side is one.

    One can argue that a person cannot be a player unless she is on a team, and thus the minimum cardinality of TEAM is mandatory. Similarly an organization cannot be a basketball team unless it has at least five players. The minimum cardinality of PLAYERS is mandatory also. One could argue in the opposite direction too. When a player quits a team, does it cease to be a team until a replacement is recruited? It cannot engage in any games, but does it cease to be a team? This is an example of the fact that each individual situation must be evaluated on its own terms. What is truth in THIS particular instance? The next time a similar situation arises, the decision might be different, due to different circumstances.