An entity diagram: entities, and the relationships between them
Drawn

The Mermaid
erDiagram
SUPPLIER ||--o{ ORDER : receives
ORDER ||--|{ ORDER_LINE : contains
PRODUCT ||--o{ ORDER_LINE : "is on"
The library / Entity diagrams
An entity is a box that lists its attributes under its name, and a relationship ends in how many. Held to the same measure, and to the rows each box lists and what each link ends in.
48 samples: 38 drawn as written, 10 drawn less something. Mermaid’s side is mermaid-cli 12.2.0 as it comes, on white. Merlive’s is 0.6.1 in its own look. What is read of an entity diagram.
Drawn

erDiagram
SUPPLIER ||--o{ ORDER : receives
ORDER ||--|{ ORDER_LINE : contains
PRODUCT ||--o{ ORDER_LINE : "is on"
Drawn

erDiagram
SUPPLIER ||--o{ ORDER : receives
INVOICE
Drawn

erDiagram
SUPPLIER ||--o{ ORDER : receives
SUPPLIER {
string name
string accountNumber
string country
}
ORDER {
int number
date placed
}
Drawn

erDiagram
ORDER {
int number
}
SUPPLIER ||--o{ ORDER : receives
ORDER {
date placed
}
Drawn

erDiagram
SUPPLIER {
}
ORDER {}
SUPPLIER ||--o{ ORDER : receives
Drawn

erDiagram
ORDER ||--|{ ORDER-LINE : contains
ORDER-LINE }o--|| DELIVERY-ADDRESS : "goes to"
Drawn

erDiagram
"Purchase order" ||--|{ "Order line" : contains
"Order line" {
int quantity
}
Drawn

erDiagram
"Händler ❤" ||--o{ "注文" : "erhält"
"注文" {
string straße
}
Drawn, less something Bold and italic are drawn as plain words

erDiagram
"A **firm** order" ||--|{ "An _order_ line" : contains
Drawn

erDiagram
s[Supplier] {
string name
}
a["Supplier account"] {
string email
}
s ||--o| a : has
Drawn

erDiagram
ORDER |o--o| INVOICE : "is billed by"
Drawn

erDiagram
INVOICE ||--|| ORDER : bills
Drawn

erDiagram
SUPPLIER }o--o{ PRODUCT : stocks
Drawn

erDiagram
ORDER }|--|{ PRODUCT : "asks for"
Drawn

erDiagram
SUPPLIER o{--|| ORDER : "is chosen for"
ORDER |{--o| INVOICE : "are billed on"
Drawn

erDiagram
SUPPLIER only one to zero or more ORDER : receives
ORDER 1 to one or more ORDER_LINE : contains
ORDER zero or one to one or zero INVOICE : "is billed by"
PRODUCT one or many to zero or many SUPPLIER : "is stocked by"
Drawn

erDiagram
SUPPLIER 1 to 0+ ORDER : receives
ORDER 1 to 1+ ORDER_LINE : contains
PRODUCT many(1) to many(0) SUPPLIER : "is stocked by"
Drawn

erDiagram
ORDER ||--|{ ORDER_LINE : contains
Drawn

erDiagram
SUPPLIER }o..o{ PRODUCT : stocks
Drawn

erDiagram
ORDER 1 to one or more ORDER_LINE : contains
SUPPLIER many(0) optionally to 0+ PRODUCT : stocks
Drawn

erDiagram
PRODUCT ||--o{ ORDER_LINE : "appears on"
Drawn

erDiagram
SUPPLIER ||--o{ ORDER : ""
Drawn

erDiagram
SUPPLIER||--o{ORDER : receives
Drawn

erDiagram
SUPPLIER ||--o{ ORDER : receives
SUPPLIER }o..o| SUPPLIER : "buys from"
Drawn

erDiagram
ORDER {
int number PK
string supplierAccount FK
string reference UK
date placed
}
Drawn

erDiagram
ORDER_LINE {
int orderNumber PK, FK
string productCode PK, FK
int quantity
}
Drawn

erDiagram
PRODUCT {
string *code
string name
}
Drawn, less something A comment is not in its row: it is in the note on its entity, which a reader sees on picking the box

erDiagram
INVOICE {
string number PK "As printed on the invoice"
string(40) reference "Only 40 characters are allowed"
decimal total
}
Drawn

erDiagram
PRODUCT {
string(20) code
string[] barcodes
decimal(10,2) price
varchar_max notes
}
Drawn

erDiagram
INVOICE {
date issued
date? paid
string? disputeReason
}
Drawn

erDiagram
direction TB
SUPPLIER ||--o{ ORDER : receives
ORDER ||--|{ ORDER_LINE : contains
Drawn, less something Drawn top to bottom: boxes of different heights are only placed that way yet

erDiagram
direction LR
SUPPLIER ||--o{ ORDER : receives
ORDER ||--|{ ORDER_LINE : contains
Drawn

erDiagram
subgraph Buying
SUPPLIER ||--o{ ORDER : receives
end
ORDER ||--o| INVOICE : "is billed by"
Drawn

erDiagram
subgraph "Paying up"
INVOICE ||--o{ PAYMENT : "is settled by"
end
Drawn

erDiagram
subgraph pay ["Paying up"]
INVOICE ||--o{ PAYMENT : "is settled by"
end
Drawn

erDiagram
subgraph Buying
SUPPLIER ||--o{ ORDER : receives
subgraph Lines
ORDER_LINE {
int quantity
}
end
ORDER ||--|{ ORDER_LINE : contains
end
Drawn, less something A relationship with a group is drawn to where the group starts, or from where it ends

erDiagram
subgraph Buying
SUPPLIER ||--o{ ORDER : receives
end
subgraph Paying
INVOICE ||--o{ PAYMENT : "is settled by"
end
Buying ||--|| Paying : "leads to"
Paying ||--o{ RECEIPT : gives
Drawn, less something The group's own direction is read past; it runs the way the rest does

erDiagram
subgraph Buying
direction LR
SUPPLIER ||--o{ ORDER : receives
end
ORDER ||--o| INVOICE : "is billed by"
Drawn, less something Its outline is broken, heavy and red as written, in the design's own red; its fill is the design's

erDiagram
SUPPLIER ||--o{ ORDER : receives
style ORDER fill:#fde,stroke:#c00,stroke-width:4px,stroke-dasharray: 5 5
Drawn, less something Their outlines are heavy and blue as written, in the design's own blue

erDiagram
SUPPLIER ||--o{ ORDER : receives
ORDER ||--|{ ORDER-LINE : contains
style ORDER,ORDER-LINE stroke:#00c,stroke-width:3px
Drawn

erDiagram
SUPPLIER ||--o{ ORDER : receives
ORDER ||--o| INVOICE : "is billed by"
classDef late stroke:#c62828,stroke-width:2px
class ORDER,INVOICE late
Drawn, less something A box is of one kind: of several classes, the first is the one it is

erDiagram
SUPPLIER ||--o{ ORDER : receives
classDef late,held stroke:#c62828
class ORDER late,held
Drawn

erDiagram
ORDER:::late {
int number
}
SUPPLIER:::trusted
SUPPLIER ||--o{ ORDER : receives
classDef late stroke:#c62828
classDef trusted stroke:#2e7d32
Drawn

erDiagram
SUPPLIER:::trusted ||--o{ ORDER : receives
ORDER ||--o| INVOICE:::late : "is billed by"
classDef late stroke:#c62828
classDef trusted stroke:#2e7d32
Drawn, less something The default class is read past: the look is the design's

erDiagram
SUPPLIER ||--o{ ORDER : receives
classDef default fill:#f9f,stroke:#333,stroke-width:4px
Drawn, less something Mermaid's own settings are read past: the look and the placement are Merlive's

---
title: Orders and who fills them
config:
layout: dagre
theme: default
look: classic
---
erDiagram
SUPPLIER ||--o{ ORDER : receives
Drawn

erDiagram
accTitle: Orders and who fills them
accDescr: A supplier receives any number of orders
SUPPLIER ||--o{ ORDER : receives
Drawn

erDiagram
%% the heart of it
SUPPLIER ||--o{ ORDER : receives
ORDER {
%% what a buyer quotes
int number
}