Curly braces hold the columns. The type comes first, then the name.
erDiagram
CUSTOMER {
string name
string email
}
ORDER {
int orderNumber
date placedAt
}PK, FK and UK mark the primary, foreign and unique keys.
erDiagram
CUSTOMER {
string custNumber PK
string email UK
}
ORDER {
int orderNumber PK
string custNumber FK
}The marks at each end say how many. A bar is one, a crow's foot is many.
erDiagram
CUSTOMER ||--o{ ORDER : places
ORDER ||--|{ LINE_ITEM : contains
PRODUCT }o--o{ TAG : taggedThe text after the colon is the verb between the two entities. More than one word needs quotes.
erDiagram
CUSTOMER ||--o{ ORDER : "places an order"
ORDER ||--|{ LINE_ITEM : contains