er (6)
er_attributes
Source (.mmd)
erDiagram
PRODUCT {
int productId PK "Auto-incremented"
string name
float price
string category FK
string sku UK "Stock keeping unit"
int quantity
boolean active
}
er_basic
Source (.mmd)
erDiagram
CUSTOMER {
int customerId PK
string name
string email UK
}
ORDER {
int orderId PK
date orderDate
string status
}
CUSTOMER ||--o{ ORDER : places
er_cardinality
Source (.mmd)
erDiagram
A ||--|| B : "exactly one to one"
C ||--o{ D : "one to zero or more"
E ||--|{ F : "one to one or more"
G o|--|| H : "zero or one to one"
er_complex
Source (.mmd)
erDiagram
CUSTOMER {
int id PK
string firstName
string lastName
string email UK
}
ORDER {
int id PK
date orderDate
string status
int customerId FK
}
LINE-ITEM {
int id PK
int orderId FK
int productId FK
int quantity
float unitPrice
}
PRODUCT {
int id PK
string name
string description
float price
int categoryId FK
}
CATEGORY {
int id PK
string name
}
CUSTOMER ||--o{ ORDER : places
ORDER ||--|{ LINE-ITEM : contains
PRODUCT ||--o{ LINE-ITEM : "appears in"
CATEGORY ||--o{ PRODUCT : groups
er_direction
Source (.mmd)
erDiagram
direction LR
USER {
int id PK
string name
}
PROFILE {
int id PK
string bio
int userId FK
}
USER ||--|| PROFILE : has
er_non_identifying
Source (.mmd)
erDiagram
PERSON {
int id PK
string name
}
ADDRESS {
int id PK
string street
string city
}
PERSON }|..|{ ADDRESS : "lives at"