How to draw an ER diagram for your database

Draw an ER diagram for your database step by step, with entities, keys and crow's foot cardinality explained through a five-table orders schema you can copy.

Written by
FlowDraw Team
Published
Reading time
7 min read
A FlowDraw board with an orders schema ER diagram: users, orders, payments, order_items and products tables joined by crow's foot lines.

The quickest way to test a database design is to draw it before anyone writes a migration. To draw an ER diagram that does that job, you need to read the marks on its lines, so we begin with a small orders schema.

Quick Answer

An ER diagram shows the tables in a database, their key fields, and how rows in one table relate to rows in another. To draw one, list your entities, give each a primary key, write each relationship as a sentence, then add foreign keys and cardinality to both ends of every line.

How to read an ER diagram

This orders schema has five tables and four lines.

An orders schema ER diagram with pins on the orders table, a primary key, a foreign key and the label on the places line.
The orders schema and its parts
  1. Table: one entity, with a row per field.
  2. Primary key: PK marks the field that identifies a row.
  3. Foreign key: FK marks a field that points to a row in another table.
  4. Line: a relationship, named with a verb.

Each line is a sentence you can say out loud:

LineSentenceWhere the key lives
placesOne user places many ordersorders.user_id
paysMany payments pay one orderpayments.order_id
containsOne order contains many order itemsorder_items.order_id
is inOne product is in many order itemsorder_items.product_id

Three choices explain its shape:

  • The foreign key sits on the “many” side. An order stores its user_id, because one column cannot hold a list of order IDs.
  • order_items is a join table. One order holds many products and one product appears in many orders, so each pair gets a row.
  • unit_price lives on the item. It copies products.price at the time of sale, so changing a price next month does not rewrite last month’s orders.

What is an ER diagram?

An entity relationship diagram, or ERD, is a map of what a system stores. Teams draw them at three levels:

  • Conceptual: entities and relationships only, for talking with people outside engineering.
  • Logical: adds attributes and keys, without tying them to one database.
  • Physical: real table names, column types and foreign keys, as on this board.

Draw one before a new feature or a migration, when an engineer joins, or when two services disagree about who owns what. If you are modeling code rather than stored data, a UML class diagram fits better.

ER diagram symbols: crow’s foot notation

Most database teams use crow’s foot notation.

The users and orders tables joined by the places line, with a single bar at users and a crow's foot at orders.
A bar at users, a crow's foot at orders

The marks at each end of a line give the cardinality: how many rows on that side can match one row on the other.

CardinalityMark at the end of the lineMeaning
OneOne barOne row
Only oneTwo barsExactly one, required
Zero or oneCircle and barOptional, at most one
ManyCrow’s footMany rows
One or manyBar and crow’s footAt least one
Zero or manyCircle and crow’s footAny number, including none

The orders schema uses plain “One” and “Many” to stay simple. When optionality matters, be exact: if a new order may have no payment yet, the payments end should read “Zero or many”.

Chen notation is the older alternative, with rectangles for entities, diamonds for relationships and ovals for attributes. It suits teaching but takes a lot of room. FlowDraw has a “Chen ER diagram” template, also on Pro.

How to draw an ER diagram

  1. Find the entities. Underline the nouns the system must remember: users, orders, products, payments. Properties such as a price become fields, not tables.

  2. Give each one a primary key. A plain id is fine. Then add the fields that explain the design.

  3. Write the relationships as sentences, both ways. A user places many orders, and an order belongs to one user. Can a user have no orders? The answers set your marks.

    The orders schema with the tables faded and the four lines dark, each with a verb and a mark at both ends.
    Every line has a verb and two marks
  4. Place the foreign keys. In one-to-many, the key goes on the many side. In one-to-one, it goes on the side that depends on the other. Many-to-many needs a join table.

    Close view of orders and products, each joined to order_items, which holds the order_id and product_id foreign keys.
    A join table turns many-to-many into two lines
  5. Test it with real questions. “What did this customer buy last month?” should trace from users to products without a gap. If you cannot trace a path, a relationship is missing.

    The schema with payments faded and a dark path running from users through orders and order_items to products.
    The path from a customer to what they bought

Draw your ER diagram in FlowDraw

ER diagrams come with Pro or Team. On Free, the template and tools open an upgrade dialog.

The FlowDraw Templates page showing ER diagram, Chen ER diagram and C4 container diagram cards, with Pro badges.
Find it under Templates in the sidebar
  1. Start the board

    On Home, click the “ER diagram” tile, or search for it under “Templates” and click “Use template”. To start blank, click “ER diagram” in the dock of a “Blank board”.

  2. Define the fields

    Select a table to open “Entity properties”. Give each field a key (“PK” or “FK”), a name and a type: int, bigint, varchar, text, boolean, decimal, date or datetime. “Add field” adds a row.

  3. Connect the tables

    With nothing selected, press L and drag from one table to another. Select the line and set “Cardinality” for each end. Double-click the line to label it with a verb.

  4. Tidy the layout

    “Auto layout” in “Entity properties” arranges the whole diagram.

  5. Review it

    Click “Share” and invite people with “Can comment”, so they can pin questions to a table. “Export” gives you SVG or PDF for the design doc.

On Free, use “Table” from “More tools”, with a row per field. Lines attach to tables, and “Ends” in “Line properties” offers the same “One”, “Many” and other marks. Write keys and types into the cells.

The orders schema open in the FlowDraw editor, with the toolbar at the bottom and Share at the top right.
The template open in the editor

With AI, on Pro or Team, click “FlowDraw AI” and set “Diagram” to “ER diagram”. Describe the data, or paste your CREATE TABLE statements:

ER diagram for an online store. Users place orders, orders contain order items, each item points to one product, and an order can have several payments. Show primary keys, foreign keys and field types.

Check the cardinality afterwards, because prose rarely says what is optional. The board is not connected to your database, so update it with each migration.

Common ER diagram mistakes

  • A many-to-many line with no join table. It looks tidy, but no relational database can store it as drawn.
  • The foreign key on the wrong side. If users holds order_id, each user can have only one order.
  • Marks at one end only. That leaves half the rule unsaid.
  • Lists in a field. A tags column holding comma-separated values is a missing table.
  • Mixed naming. Order, users and product_item make every query a guess.
  • A diagram that drifts. Change it in the same pull request as the schema.

New here? Create an account and try the same layout with tables.

FAQ

A schema is the actual definition of the tables in a database. An ER diagram is a picture of it, or of a design for it. A physical ER diagram matches the schema closely, while a conceptual one leaves out keys and types.

Continue Reading

A FlowDraw board with a UML class diagram of a permissions model: Shareable, Resource, Board, Space, Workspace, Member, User and Role.

Guides·

How to draw a UML class diagram

Learn to draw a UML class diagram: what the boxes, lines and multiplicities mean, how to choose a relationship, and a permissions model worked through.

A FlowDraw board with a Gantt chart for a website relaunch: 14 tasks in a table, bars across January to March 2027 and a red today line on Feb 18.

Guides·

How to make a Gantt chart

Learn how to make a Gantt chart: list the tasks, set dates and owners, link dependencies and track progress, then edit a free template in FlowDraw.

A FlowDraw board with a work breakdown structure for Customer conference 2027: five phases, each split into deliverables and numbered work packages.

Guides·

How to create a work breakdown structure

A work breakdown structure splits a project into phases, deliverables and work packages. Learn the 100% rule, how to size work and how to draw one.

Ready to create your first diagram?

Turn your ideas, notes, or documents into a clear,
editable flowchart in seconds.

Get Started Free