Entity-Relationship Diagram (ERD)

1. What is an Entity-Relationship Diagram?

  • An Entity-Relationship Diagram (ERD) is a visual representation of the data structure of a system. It shows the relationships between data entities in a database.
  • ERDs are widely used in database design to model the relationships between data elements and ensure a well-structured database schema.
  • Key Benefits:
    • Helps in database design by organizing data efficiently.
    • Clarifies business rules and relationships between data elements.
    • Improves communication between database developers, business analysts, and stakeholders.
    • Reduces data redundancy and ensures data integrity in relational databases.
    • ERDs are essential in database normalization, ensuring a well-structured and scalable database model.
    • Helpful in depicting system architecture.

2. Common Diagramming Symbols

Entities: Rectangles represent objects or concepts that store data.
Attributes: Ellipses (ovals) connected to a rectangle describe properties or characteristics of an entity.
Relationships: Diamonds or labeled lines define the associations between entities.
Primary Key (PK): Attributes that are underlined and/or marked with "PK" indicate a unique identifier for each record in an entity.
Foreign Key (FK): A dashed underline or italicized text denotes an attribute that establishes a relationship between two entities by referencing a primary key from another entity.
  • The symbols used are typically based on the tool notation (e.g., Chen & SQL, Crow’s Foot, UML).

3. Relationship Types

  • Entities can have a variety of relationship types with other entities.
  • The three most common are:
    • One-to-One (1:1): Each entity instance relates to only one instance of another entity.
    • One-to-Many (1:M): One entity instance relates to multiple instances of another entity.
    • Many-to-Many (M:N): Multiple instances of one entity relate to multiple instances of another entity.
  • Symbols can also be used to denote relationships. Below are some examples of relationship symbols:

3. Examples