Entity-Relationship (ER) diagrams are used to describe the cardinality in databases. There are three relationship types or cardinalities: one-to-one, one-to-many, and many-to-many. In other words, cardinality describes a fundamental relationship between two entities or objects.
So, the relationship between a Consult and a Diagnosis is a one-to-one relationship. On the other hand, each consult is associated with exactly one diagnosis. Therefore, the relationship between the Doctor entity and the Consult entity is one doctor to many consults (a one-to-many relationship). For example, a doctor can have one or many consults on a given day.
Let's take a look at the doctor consultation relationship found in a medical practice database. Cardinality defines how many instances of one entity are related to instances of another entity. In databases, cardinality refers to the relationships between the data in two database tables. It translates into the number of elements in a set. What is cardinality in data modeling? And how do you implement cardinality in databases? This discussion uses simple, easy-to-follow examples to describe both the theory and modeling of cardinality in ER diagrams.Ĭardinality is a mathematical term.