ER diagram

Updated

An ER diagram (short for entity relationship diagram, also written ERD) is a diagram that shows the things a database stores, the details kept about each one, and how they relate to each other. The entity relationship model was introduced by Peter Chen in 1976 and is still the standard way to plan a relational database before building it.

Parts of an ER diagram

  • Entity: a thing the system keeps data about, such as Customer, Order or Product. In a database it becomes a table.

  • Attribute: a detail of an entity, such as name, email or price. It becomes a column.

  • Primary key: the attribute that identifies each record, such as a customer ID.

  • Foreign key: an attribute that points to the primary key of another entity.

  • Relationship: a line between two entities, labeled with how they are connected, such as "places" or "contains".

Cardinality in ER diagrams

Cardinality says how many records on one side can relate to records on the other:

  • One to one: each employee has one company badge.

  • One to many: one customer places many orders.

  • Many to many: a student takes many courses and a course has many students. In a database this is usually resolved with a linking table.

Crow's foot notation, the most common style, draws these with a single bar for "one" and a three pronged foot for "many".

Types of ER diagrams

  • Conceptual: only the main entities and relationships, for discussion with non technical stakeholders.

  • Logical: adds attributes and keys, without details of a particular database product.

  • Physical: adds data types, indexes and constraints, ready to be built.

How to draw an ER diagram

  1. List the entities. Read the requirements and pick out the nouns the system must remember.

  2. Add attributes and keys. Give each entity a primary key.

  3. Connect the entities. Draw each relationship and name it.

  4. Set the cardinality. Decide one or many on each end, and whether the relation is optional.

  5. Resolve many to many relationships with linking entities, then review the model with the team.

Example

Sofia plans the database for a veterinary clinic. Her entities are Owner, Pet, Appointment and Vet. One owner has many pets, one pet has many appointments and each appointment is with one vet. Drawing the diagram shows that prescriptions need their own entity linked to appointments, a gap she finds before any table is created.

ER diagram vs other diagrams

An ER diagram describes stored data. A data flow diagram shows how that data moves through a system, and a class diagram, one of the UML diagrams, adds behavior to the data. An architecture diagram shows where the database sits in the whole system.

ER diagrams in MockFlow

Describe your data in a sentence and the AI database diagram generator drafts the tables and relationships on a MockFlow board. You can also begin with the entity relationship diagram template, use the database schema designer skill, or work through a design with the database schema architect concept builder. Teams review the model together on a whiteboard for developers.

MockFlow

Turn ideas into plans on one board.

No account needed
mockflow.com/new

Open a blank board in one click. Boards last 24 hours, so sign up to keep one.

MCPBrainstorm with MockFlow MCP

Add MockFlow as an MCP connector in Claude, Cursor, or any MCP-compatible AI assistant to generate flowcharts, mindmaps, architecture diagrams, and 16 types of visualizations.

Desktop App MCP Powerful
CLI Web MCP Developer
Web MCP Easiest

Built into the MockFlow Desktop App. AI creates visuals directly on your open canvas — no URLs, no waiting.

1
Open Desktop App → open a MockFlow project
2
In Claude Code / Cursor, run:
claude mcp add --transport http -s user mockflow-ideaboard http://localhost:21193/mcp
3
Ask: "Create a flowchart for..."

Best for: Designers, product teams, daily MockFlow users.

Download Desktop App →

Install from npm, log in via browser (OAuth), and boards are saved to your MockFlow account.

1
npm install -g @mockflow/ideaboard-mcp
2
mockflow-ideaboard-mcp login
3
mockflow-ideaboard-mcp

Best for: Developers using Claude Code, Cursor, or VS Code Copilot.

npm Package →

Add MockFlow as a connector in Claude.ai or ChatGPT. No installation. A new board is created and you get a shareable URL.

1
Open Claude.ai → Settings → Connectors
2
Paste this URL, then click Connect and sign in to MockFlow: https://app.mockflow.com/ideaboard/connector/mcp
3
Ask Claude to create a flowchart — done!

ChatGPT: use https://app.mockflow.com/ideaboard/mcp and save its boards to your account to keep them

Best for: Managers, marketers, anyone using Claude.ai or ChatGPT in the browser.

Welcome back
Don't have an account? Sign up

Faster ways in

Sign in with an account you already use.