One-to-one relationships

One to many relationship is a type of cardinality that refers to a relationship between two entities in an entity relational diagram (between two tables in a database). A simple example would be a binding between the entities person and birth_certificate. Each person must have their own birth certificate.

Graphically, the one to one relationship is shown as follows:

one-to-one relationship

One-to-one relationships in Moon Modeler

Every time you create a new relationship between tables, a one-to-many relationship is created. To change to a one-to-one relationship, edit the properties of the relationship. Just set the cardinality value to One and the notation will change.

one-to-one relationship settings

Alternate solution

If it is not necessary to keep records of birth certificate entries in another database table, you can store these records in the same table and use e.g. JSON format which can be further structured. Moon Modeler can also visualize JSON data types. So in our case, we really just need to create one person table and one JSON object birth_certificate. You can then create a new column certificate in the person table and assign it a JSON object called birth_certificate as the data type. The graphical representation in the ER diagram is then as follows.

alternate solution to one-to-one relationship

The generated SQL script contains the JSON definition.

script with json

Types of relationships in ER diagrams

Get started today and try Moon Modeler – ER diagram tool!

Download Read Quick Start Guides

Quick links

Free Trial Buy Now!

Blog categories