Mapping cardinalities, or cardinality ratios, express the number of entities to which another entity can be associated with via a relationship set. They are most useful in describing binary relationship sets, however, they can be used to describe relationships sets involving more than two entity sets.

One-to-One: An entity in A is associated with, at most, one entity in B, and an entity in B is associated with, at most, one entity in A.

a1 - b1
a2 - b2
a3 - b3

One-to-Many: An entity in A is associated with any number of entities in B. An entity in B, however, can be associated with, at most, one entity in A.

a1 - b1, b2
a2 - b3, b4, b5
a3 - b6

Many-to-One: An entity in A is associated with, at most, one entity in B. An entity in B can be associated with any number of entities in A.

        a1 - b1
    a2, a3 - b2
a4, a5, a6 - b3

Many-to-Many: An entity in A can be associated with any number of entities in B. An entity in B can be associated with any number of entities in A.

        a1 - b1
    a2, a3 - b2, b3
a4, a5, a6 - b4, b5


SOURCE: Database System Concepts, Abraham Silberschatz, Henry F. Korth, S. Sudarshan.
Mathematicians really can't be blamed for thinking that most computer science is actually simple applied mathematics invented by people who didn't even bother to look up the proper mathematical terminology.

In mathematics, a 'relationship set' is called a relation. A many-to-one relation is called a function. A one-to-one relation is called an injective function.

For the terms 'one-to-one', 'many-to-one', etc. we can at least say that they are household words. But the term 'mapping cardinalities' is very confusing even to your fellow computer scientists. I've never heard it before. It suggests we're mapping cardinalities onto each other, which we're not, and it suggests infinite cardinalities, but they are finite (and typically, very small).

Booh!

P.S. It turn out that Database System Concepts, like many other textbook in introductory courses on relational databases, goes at some length to keep the presentation informal of what is fundamentally a formal mathematical theory. The authors purposely avoid all reference to actual mathematical notation or terminology; the phrase "mapping cardinalities" is just a symptom of this general approach. While informal, the resulting description is still accurate, but it is very incomplete; as soon as you try to use it for anything but trivial cases, you run into undefined areas.

In this usage of "map", the intended meaning is to determine the relation between cardinalities. To quote the dictionary sitting next to me, cardinality is "the number of elements in a given mathematical set." Combine the two and we have "determine the relation between the number of elements in either set." This is exactly what we are striving for. Since this is a phrase often used when talking about relational databases, it is safe to asssume that the intent is to define legal ways for tables to relate to one another.

One common mistake made by mathematicians and even other computer scientists is in mistaking the terminology of one discipline for another. For example, most biologists don't barge into a lecture on data structures and insist that the term tree isn't accurate, since it's upside down. And even if it was turned right side up, the root would extend further and branch out, not to mention a plethora of other simplifications. There are two reasons they don't do this. One, biologists and computer scientists are usually not crammed into the same room for extended periods of time. Two, they realize that any given group of academics will develop their own 'dialect' that is only meaningful to other academics in the same discipline.

In closing, I would like to apologize to Georg Cantor and rp for ever having used "cardinality" to describe the size of a finite set.

Log in or register to write something here or to contact authors.