Skip to content

Instantly share code, notes, and snippets.

@pvgomes
Created March 10, 2026 08:14
Show Gist options
  • Select an option

  • Save pvgomes/4b1bbe912c8f0df0d6fab021ce70ec48 to your computer and use it in GitHub Desktop.

Select an option

Save pvgomes/4b1bbe912c8f0df0d6fab021ce70ec48 to your computer and use it in GitHub Desktop.

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"
Loading

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"
Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment