0.6.13 Entity Relationship Diagrams

An ERD Visualizes Structured Data

An entity-relationship diagram, or ERD, is a visual model of structured data.

It can show:

  • entities;
  • attributes;
  • identifiers;
  • relationships between entities.

An ERD helps answer questions such as:

  • What kinds of records exist?
  • What information belongs to each kind?
  • Which attribute identifies each record?
  • How are the record types related?
Begin With the Entities

For a simple music library, the entities might be:

Song
Artist
Album

Each entity represents a kind of record.

The ERD does not need to show every individual song or artist record.

It describes the structure those records follow.

Add the Attributes

A simple model might include:

Song
Song ID
Title
Genre
Year
Artist ID
Album ID
Artist
Artist ID
Artist Name
Album
Album ID
Album Name

The attributes describe the information stored for each entity.

Identify the Unique Identifier

Each entity needs a reliable way to distinguish its records.

For example:

Song ID
Artist ID
Album ID

These unique identifiers let the data system tell one record from another.

In an ERD, the identifier is visually marked according to the diagramming convention being used.

The important meaning is:

Relationships Connect Entities

The Song entity is related to Artist.

Conceptually:

Artist -------- Song

One artist can be associated with many songs.

The Song entity is also related to Album:

Album -------- Song

One album can contain many songs.

The ERD makes those structural relationships visible.

IDs Support the Relationship in the Data

The Songs table may contain:

Artist ID
Album ID

Those values refer to records in the related entities.

For example:

Song:
S002 | Northern Lights | A002 | AL05

can refer to:

Artist:
A002 | Example Band

and:

Album:
AL05 | Open Roads

The ERD shows the relationship concept.

The matching IDs make the relationship work in the structured records.

Read a Relationship in Plain Language

A useful habit is to turn the diagram into sentences.

For example:

If you cannot explain the relationship clearly in ordinary language, the diagram may not yet communicate the intended data structure.

An ERD Is Not a Spreadsheet Screenshot

A spreadsheet shows actual rows and values.

An ERD shows the structure behind those rows.

Spreadsheet:

S002 | Northern Lights | A002 | AL05

ERD:

Song
- Song ID
- Title
- Artist ID
- Album ID

The two artifacts answer different questions.

The table shows current data.

The ERD describes how that kind of data is organized.

Keep the Model Focused

The music library could contain many possible entities:

  • Playlist;
  • Listener;
  • Rating;
  • Concert;
  • Label.

Do not add them unless the current data problem requires them.

An ERD is an abstraction.

Model the entities and relationships needed for the current purpose.

Relationship Structure Matters

If the data says one artist can have several songs, the ERD should not imply that every artist can be connected to only one song.

The diagram must represent the intended data relationship accurately.

At this introductory level, focus on recognizing and expressing straightforward connections such as:

one Artist → many Songs

and:

one Album → many Songs
ERDs Prepare Data for Consistent Use

A clear ERD gives people a shared description of:

  • what record types exist;
  • which fields belong to them;
  • how they are identified;
  • how they connect.

That shared model makes later data entry, import, analysis, and software use easier to reason about.

The comparison between ERDs and UML class diagrams comes later.

For now, treat the ERD as the data-oriented model for this structured dataset.