CSE Roadmap

Core tier · about 3 hours · 5 parts

Part 3 of 5 · 1 min read

Cardinality

How many entities on each side of a relationship can actually participate.

Think of a wedding, where one officiant marries one couple at a time. Compare that to a school, where one teacher teaches many students, and one student has many teachers over the years.

In plain words: cardinality describes how many instances of each entity can participate in a relationship. One-to-one means each entity on either side connects to at most one of the other. One-to-many means one entity on one side connects to many on the other, but each of those connects back to only one. Many-to-many means entities on both sides can connect to many of the other.

A worked example. Author to Book is one-to-many: one author can write many books, but each book has one author, in this subject's simplified model. Customer to Book, through orders, is many-to-many: a customer can order many books, and a book can be ordered by many customers.

The key lines. The cardinality drawn as crow's-foot style notation, shown in plain text:

Author  1 ----< many  Book
Customer many >---- many  Book   (through Order)

Cardinality

Cardinality describes how many instances of one entity can participate in a relationship with instances of another: one-to-one, one-to-many, or many-to-many.

Example: Author-to-Book is one-to-many; Customer-to-Book, through orders, is many-to-many.