Cardinality (data modeling)


In data modeling, the cardinality of one data table with respect to another data table is a critical aspect of database design. Relationships between data tables define cardinality when explaining how each table links to another.

In the relational model, tables can be related as any of: many-to-many, many-to-one (rev. one-to-many), or one-to-one. This is said to be the cardinality of a given table in relation to another.

For example, considering a database designed to keep track of hospital records. Such a database could have many tables like:

  • a Doctor table full of doctor informations
  • a Patient table with patient informations
  • and a Department table with an entry for each department of the hospital.

In that model:

  • There is a many-to-many relationship between the records in the doctor table and records in the patient table (Doctors have many patients, and a patient could have several doctors);
  • a one-to-many relation between the department table and the doctor table (each doctor works for one department, but one department could have many doctors).

one-to-one relationship is mostly used to split a table in two in order to optimize access or limit the visibility of some informations. In the hospital example, such a relationship could be used to keep apart doctor's personal or administrative informations.


A crow's foot shows a one-to-many relationship, single line is a one-to-one relationship.

UML Modeling

UML class diagram may be used for data modeling. In that case, relationship are modeled using UML associations, and multiplicity is used on those associations to denote cardinality. Here are some examples:

left right
1 1 one-to-one
0..1 1 optional on one side one-to-one
0..* or * 0..* or * optional on both sides many-to-many
1 1..* one-to-many

External links







stock | retire | vm
Why are we here?
All text is available under the terms of the GNU Free Documentation License
This page is cache of Wikipedia. History