Colophon comes from the Greek word “κολοφων” or “kolophon,” which means “summit” or “finishing touch.” It is a description of the details and methods behind a publication and is often found on the last few pages of books.

This “Customers, Orders, Products” Notion Template was created by Nick Gracilla for the article Document Notion Databases With ER Models in Mermaid, and is licensed under **CC BY-SA 4.0. You are free to share and adapt, even for commercial use, but you must give appropriate credit.

erDiagram

%% You're not required to first define entities this way; they are created when relationships are established. But it's clear 🙂

Customers
Orders
Products

%% ER crow's foot notiation: { or } represent many; | represents at least one; and the letter o represents zero or many. the -- connects two entities and the relations they have to each other, with a label:

Customers }|--o{ Orders : "have"
Orders }o--|{ Products : "contain"
Customers }o--o{ Products : "have through Orders"
erDiagram

%% Let's do it again, with flair. I define the entity relationships with Notion-style language: 

Orders }o--|{ Products : "two-way relation"
Customers }|--o{ Orders : "two-way relation"
Customers }o--o{ Products : "rollup through Orders"

%% and set out the key relationships, rollups, and formulas, too. Probably the relations here are redundant, but it's nice to be reminded when reading. 

Customers {
	relation Orders
	rollup-Products-thru-Orders orderedProducts
  rollup-sum-Orders-total lifetimeValue
}

Orders {
	relation Customer
	relation Products
  rollup-sum-Products-price rollupTotal
  formula-as total
}

Products {
	relation Orders
	rollup-Customers-thru-Orders purchasedBy
  number price
}