# Entity-Relationship Diagram (ERD)

> A drawing of boxes and lines. It shows the things you track and how they link.

**Field:** Data Engineering  
**Category:** Foundations  
**Also known as:** ERD, ER Diagram, Entity-Relationship Model, Database Diagram

## Think of it like

It is like a family tree. Boxes are people, and lines show who belongs to whom.

## Definition

An entity-relationship diagram is a drawing of a data model. Each box is an entity, a thing you track, like a customer or an order. Inside the box are the fields you keep about it. Lines between boxes show how the things link. Marks at the ends of a line show how many, such as one customer to many orders.

## Example

Before building a booking app, Emma draws an ERD. It shows that one member can make many bookings, but each booking is for one class.

## Example code

```mermaid
erDiagram
    CUSTOMER ||--o{ ORDER : places
    ORDER ||--|{ LINE-ITEM : contains
```

An ERD typed as text. A tool draws it as boxes, with one customer to many orders.

## Why it matters

A drawing shows mistakes that are hard to spot in tables. Fixing a line on paper is far cheaper than fixing a live database.

## Common mistake

Drawing every field and table at once. Start with the main boxes and lines, then add the detail.

## Three principles

- **Boxes are things.** Each box is one thing you track.
- **Lines are links.** A line shows two things are related.
- **Ends are counts.** Marks on the ends say one or many.

## Related terms

- [Data Model](https://learn.benibix.com/term/data/data-model)
- [Conceptual Data Model](https://learn.benibix.com/term/data/conceptual-data-model)
- [Logical Data Model](https://learn.benibix.com/term/data/logical-data-model)
- [Primary Key](https://learn.benibix.com/term/development/primary-key)
- [Foreign Key](https://learn.benibix.com/term/development/foreign-key)
- [Database Schema](https://learn.benibix.com/term/development/schema)
- [Unified Modeling Language (UML)](https://learn.benibix.com/term/development/uml)

## Told apart from

- [ERD vs Database Schema](https://learn.benibix.com/compare/entity-relationship-diagram-vs-schema): People think an ERD and a database schema are the same thing, and they are not. The schema is the real set of tables and columns inside the database. An ERD is a drawing of it. You can change the drawing all day, and the database stays the same until you change the schema.

## Taught in

- [Data Models and ER Diagrams](https://learn.benibix.com/learn/data-foundations/data-models-and-er-diagrams): Data Engineering Basics, 9/11

![Three boxes, each a table with a header: Customer with id, name and email; Order with id, customer_id and date; Line item with order_id, product and quantity. A line labelled places joins Customer to Order, and a line labelled contains joins Order to Line item. Each line has two bars at the left end and a crow's foot at the right end. A key below says two bars mean exactly one and a crow's foot means many.](https://learn.benibix.com/diagrams/dat-erd.svg)

---

Source: https://learn.benibix.com/term/data/entity-relationship-diagram
Author: Behnia Zarei (a developer in Vienna, Austria, who builds and teaches data, AI and business intelligence at BENIBIX)
Publisher: BENIBIX Learn (https://learn.benibix.com/)
Last updated: 2026-11-20
Licence: CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Quote freely with attribution.
