Database Relations: 1:1, 1:N, N:N

The most current version as of .

Entities in databases can have relationships with other entities. These relationships are called relations. In this article we will learn about the different types of relations.

Basically, a relation is a way to connect two entities.

There are three types of relations:

1:1 Relations

If there is a unique relation between two entities, we call it a 1:1 relation.

Examples

1:N Relations

We speak of 1:N relations when there is a relation between one entity and many other entities.

Examples

N:N Relations

If there are many relations between two entities in both directions, we call it a N:N relation.

Since N:N relations are not unique, they are not valid in databases. Rather they have to be split into 1:N and 1:1 relations by using additional tables.

Examples

— David Wolf