BA Prince the B.A. Subscribe

Home / draw.io for Business Analysts

ER Diagram in draw.io With Crow's Foot Notation

ER Diagram in draw.io With Crow's Foot Notation

Watch on YouTube Subscribe

Draw an entity relationship diagram with crow's foot notation for free in draw.io. Learn how to turn on the Entity Relation shapes, add entities with keys and attributes, pick the right crow's foot line, and fix a many-to-many with a junction entity, using an online shop.

Step by step

Data on one page

  1. ER diagrams. An ER diagram shows what data a system keeps and how the data connects. Business analysts use it to agree on the data with the team. Here we draw one for a small online shop.
  2. Blank diagram. Open draw.io and start a blank diagram.
  3. ER shapes. The ER shapes are not shown by default. Click More Shapes, tick Entity Relation and click Apply. The Entity Relation shapes now appear in the shapes panel.

Entities

  1. Entity. An entity is a thing you keep data about. Drag the Entity box onto the page and name it with a singular noun: Customer.
  2. Keys. Double-click the attribute area and type one attribute per line: customer_id (PK), name and email. The primary key goes first. It is the ID that makes each customer unique.
  3. Entity. Add a second entity the same way and name it Order.
  4. Keys. Give Order the attributes order_id (PK), customer_id (FK) and order_date. customer_id is a foreign key. It sits on the many side and links each order to one customer.

Crow's foot lines

  1. Crow's foot. Click Customer, hold Ctrl and click Order, then click the 1 Mandatory to Many Optional line. draw.io joins the two boxes. The line reads: one customer places zero or many orders.

Many to many

  1. Many to many. An order has many products, and a product appears on many orders. That is many-to-many, and you should never draw it as a single line. Start by adding a Product entity. Give it product_id (PK), name and price.
  2. Junction entity. Then add a junction entity between Order and Product, called Order item. It has one row for each product on an order. It holds both foreign keys, order_id (FK) and product_id (FK), plus quantity.
  3. Two one-to-many. Select Order and Order item, then click the 1 Mandatory to Many Mandatory line. Every order has at least one order item. Then connect Product to Order item with 1 Mandatory to Many Optional. A product may not have been ordered yet.
  4. The finished diagram. Click an empty part of the page to see the finished diagram. The many-to-many is now two simple one-to-many lines.

Recap

  1. The rules. The rules: name entities with singular nouns, put the primary key first, put the foreign key on the many side, and turn every many-to-many into a junction entity.

Common mistakes

  • Drawing a many-to-many as one line. A database can't store that directly. Add a junction entity, like Order item, that holds both foreign keys. Then connect each side to it with a one-to-many line.
  • Putting the foreign key on the wrong side. The foreign key goes in the entity on the many side. customer_id goes in Order. order_id does not go in Customer, because one customer can have many orders.
  • Mixing up mandatory and optional ends. Read the line out loud before you pick it. If one customer places zero or many orders, use Many Optional on the Order end. If every order must have at least one item, use Many Mandatory.
  • Not finding the crow's foot lines. They are not in the default shapes panel. Click More Shapes, tick Entity Relation and click Apply. The entity boxes and crow's foot lines will then appear.

When a business analyst uses this

In a requirements workshop for a new ordering system, a business analyst draws the ER diagram live in draw.io. The business can then confirm rules such as "every order has at least one item" before developers design the database. The agreed diagram goes into the requirements document for sign-off.

Questions people ask

Can I draw ER diagrams in draw.io for free?

Yes. draw.io is free, and its Entity Relation shapes include crow's foot lines. Turn them on with More Shapes, tick Entity Relation, then Apply.

What do the symbols in crow's foot notation mean?

The 3-pronged crow's foot means many, a bar means one and a circle means zero. So a circle with a crow's foot reads zero or many, and a bar with a crow's foot reads one or many.

How do you show a many-to-many relationship in an ER diagram?

Add a junction entity between the two entities, such as Order item between Order and Product. It holds both foreign keys, and each side links to it with a one-to-many line.

More in draw.io for Business Analysts