Archyno

Templates

ER diagram template

Six entities in crow's foot notation, primary and foreign keys filled in, and a junction table already resolving the many-to-many that every first draft gets wrong.

Notation: ER - crow's footDiagram: Entity-relationship diagram

placescontainsappears onfiled undergroupsCustomerPK customer_idnameemailcreated_atOrderPK order_idFK customer_idplaced_atstatusOrderLinePK order_line_idFK order_idFK product_idquantityProductPK product_idskunameunit_priceProductCategoryPK product_category_idFK product_idFK category_idCategoryPK category_idnameslug
The template as it opens. The junction entity is the row most drafts are missing.

Open this template in Archyno

It opens as an editable model, not an image. Change it in the browser, then export to PNG, SVG, Mermaid, XMI, or a Sparx .qea file.

Open this template

What is on this diagram

Customer
The party. Its primary key is the one every other table borrows.
Order
The transaction. Carries customer_id as a foreign key.
OrderLine
The lines. Two foreign keys, because it belongs to two parents.
Product
The catalogue entry an order line points at.
ProductCategory
The junction. This is how a many-to-many is actually stored.
Category
The grouping. Reached only through the junction, never directly.

How to make it yours

  1. Rename the entities to your nouns, singular. A table called Orders and an entity called Order are different levels.
  2. Check every crow's foot before you touch an attribute - cardinality is the part a schema cannot fix later.
  3. Keep one primary key per entity and mark every foreign key. An unmarked FK is a join nobody can find.
  4. Leave the junction entity in place if you have any many-to-many. Deleting it does not remove the problem.
  5. Add the nullable columns last, and make the decision explicit for each one.

Common questions

What is crow's foot notation?

The cardinality notation where the end of a relationship line carries a symbol reading as a pair: a bar for one, a three-pronged foot for many, and a circle for optional. It is the notation almost every database tool draws, and it is what this template uses.

How do I model a many-to-many relationship?

With a third entity between the two, carrying a foreign key to each. A relational database cannot store a many-to-many any other way, so drawing the line directly hides work rather than saving it. This template ships that junction already resolved.

Is an ER diagram the same as a UML class diagram?

No. They look similar and describe different things: an ER diagram describes data at rest, with keys and cardinality, and a class diagram describes objects with behaviour and inheritance. A class diagram has operations and an ER diagram never does.

Read the notation

All templates