DEV Community

Cover image for Types of Relationships in ER Diagrams
Kenta Takeuchi
Kenta Takeuchi

Posted on • Originally published at bmf-tech.com

Types of Relationships in ER Diagrams

#er

This article was originally published on bmf-tech.com.

Overview

This post summarizes the types of relationships in ER diagrams.

Types of Relationships in ER Diagrams

There are three types of relationships in ER diagrams.

Type of Relationship Table Relationship Line Type
Dependent Relationship Child table depends on parent table (parent-child relationship exists between tables) Solid line (Parent → Child)
Independent Relationship Child table does not depend on parent table (no parent-child relationship exists between tables) Dotted line (Parent → Child)
Many-to-Many Relationship Many-to-many table relationship Solid line (Parent ↔ Child)

Dependent Relationship

  • User

    • User No (PK)
    • Company No (FK)
    • Name
    • Email Address
  • User Profile

    • User No (FK)
    • Age
    • Gender

The child table, User Profile, cannot exist without a record in the parent table, User, so it can be said that the child table depends on the parent table.

Independent Relationship

  • User

    • User No (PK)
    • Company No (FK)
    • Name
    • Email Address
  • User Profile

    • User No (FK)
    • Age
    • Gender
  • Company

    • Company No (PK)
    • Company Name

As explained earlier, the relationship between User and User Profile is a dependent relationship.

The relationship between User and Company is independent because a customer can exist without a user, and vice versa.

Many-to-Many Relationship

  • User

    • User No (PK)
    • Company No (FK)
    • Permission No (FK)
    • Name
    • Email Address
  • Permission

    • Permission No (PK)
    • User No (FK)

This relationship requires a junction (intermediate, pivot) table.

Thoughts

I want to read more books and delve deeper into this topic.

References

Top comments (0)