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:

An ERD helps answer questions such as:

Begin With the Entities

For a simple music library, the entities might be:

Plain text
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

Plain text
Song ID
Title
Genre
Year
Artist ID
Album ID

Artist

Plain text
Artist ID
Artist Name

Album

Plain text
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:

Plain text
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:

This attribute uniquely identifies a record of this entity.

Relationships Connect Entities

The Song entity is related to Artist.

Conceptually:

Plain text
Artist -------- Song

One artist can be associated with many songs.

The Song entity is also related to Album:

Plain text
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:

Plain text
Artist ID
Album ID

Those values refer to records in the related entities.

For example:

Plain text
Song:
S002 | Northern Lights | A002 | AL05

can refer to:

Plain text
Artist:
A002 | Example Band

and:

Plain text
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:

An Artist can be related to multiple Songs.

A Song is related to an Artist.

An Album can contain multiple Songs.

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:

Plain text
S002 | Northern Lights | A002 | AL05

ERD:

Plain text
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:

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:

Plain text
one Artist → many Songs

and:

Plain text
one Album → many Songs

ERDs Prepare Data for Consistent Use

A clear ERD gives people a shared description of:

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.