Entity Relationship Diagram
Last updated
Last updated
An Entity-Relationship Diagram (ERD) is a visual representation of the relationships between entities in a database. It is a powerful tool used in software development and database design to model and understand the structure of a relational database.
There are many different notations and there is no standard. We are using the crows-feet notation. You can build your own ERD in .
Let's walk through an example database design problem and visualise it with ERD!
Design a system that stores the users and their notebooks. Each notebook has a name and description. Each notebook contains several notes (but can be empty) and each note has a title and contents. A user can own multiple notebooks but each notebook belongs to exactly one user, and each note belongs to exactly one notebook. Each user has a username, email, and password that they store.
In an Entity-Relationship Diagram (ERD), an entity represents a real-world object or concept. Entities can be classified as either .
Entities have properties, also known as attributes, which describe their characteristics.
Primary Key(PK)
Foreign Key(FK)
Unique
...
Relationships represent associations between entities. There are three types of relationships:
one-to-one (1-1)
A one-to-one relationship means that each instance of one entity is associated with exactly one instance of another entity.
many-to-one (M-1)
A many-to-one relationship means that multiple instances of one entity can be associated with a single instance of another entity.
many-to-many (M-M)
A many-to-many relationship means that multiple instances of one entity can be associated with multiple instances of another entity.
An enhanced ERD (EERD) extends the capabilities of a traditional ERD by introducing additional concepts such as specialization/generalization, aggregation, and inheritance. These concepts allow for more complex modeling of relationships and behaviors in a database system.