Crow's foot notation
erDiagram
CUSTOMER ||--o{ ORDER : "places / placed by"
ORDER ||--|{ ORDER_ITEM : "contains / belongs to"
PRODUCT ||--o{ ORDER_ITEM : "included in / includes"
PERSON ||--|{ ROUTE : "assigned to / assigned by"
CUSTOMER }o--|| ROUTE : "belongs to / covers"
ORDER_ITEM ||--o{ DELIVERY : "fulfilled by / fulfils"
ROUTE ||--o{ DELIVERY : "executed by / executes"
UML notation with columns
erDiagram
CUSTOMER {
int customer_id PK
string first_name
string last_name
string address
string postcode
string phone
}
PERSON {
int person_id PK
string first_name
string last_name
string phone
enum role "delivery, manager, admin"
}
PRODUCT {
int product_id PK
string name
string description
date created_date
decimal price
}
ROUTE {
int route_id PK
int person_id FK
string geographic_area
int max_addresses
enum schedule "weekday, sunday"
}
ORDER {
int order_id PK
int customer_id FK
date order_date
}
ORDER_ITEM {
int order_item_id PK
int order_id FK
int product_id FK
int quantity
}
DELIVERY {
int delivery_id PK
int order_item_id FK
int route_id FK
date delivery_date
}
CUSTOMER ||--o{ ORDER : "places / placed by"
ORDER ||--|{ ORDER_ITEM : "contains / belongs to"
PRODUCT ||--o{ ORDER_ITEM : "included in / includes"
PERSON ||--|{ ROUTE : "assigned to / assigned by"
CUSTOMER }o--|| ROUTE : "belongs to / covers"
ORDER_ITEM ||--o{ DELIVERY : "fulfilled by / fulfils"
ROUTE ||--o{ DELIVERY : "executed by / executes"