One to One Relationship (Entity-Relationship Diagram)

The relationships in data models can be represented by various types of associations depending on which cardinality is required.

A one-to-one relationship is a type of relationship in ER diagram that assigns one entity to another entity. A foreign key attribute references one or zero instances of the other entity. This type of relationship is useful when we do not want to allow the assignment of multiple entities.

The crow's foot notation depicts the one-to-one relationship as a line with a short perpendicular line on each end.

Graphical notation for a one-to-one relationship
Graphical notation for a one-to-one relationship

One to One in Database

On the database level, a one-to-one relationship represents the assignment of one row (of an entity) to one or zero rows (of another entity). There are two basic ways how to ensure this limitation in the database:

  • set both columns as primary keys
  • set one column as the primary key and the other column as unique

One to One Relationship Example

An example of a one-to-one association can be between a Person and an ID card. A person can have only one active ID card. You can find the data model of the one-to-one relationship below:

One-to-one relationship
One-to-one relationship

How to Create One to One Relationship?

You can add a one-to-one relationship using a dedicated tool from the toolbox. Choose 1 to 1 button and drag it between two entities to connect them. Another way to connect to entities with the relationship is to select the tool and drag from the foreign key attribute of an entity to the primary key attribute of the other entity. The inserted relationship will connect not only two specified entities but also the chosen attributes.

New Comment