Skip to content

Instantly share code, notes, and snippets.

@PhilippSalvisberg
Last active February 24, 2026 14:09
Show Gist options
  • Select an option

  • Save PhilippSalvisberg/07ad69adad83c7bbb19ac7c5e505cc0e to your computer and use it in GitHub Desktop.

Select an option

Save PhilippSalvisberg/07ad69adad83c7bbb19ac7c5e505cc0e to your computer and use it in GitHub Desktop.
ERD example with Mermaid

ERD

see Mermaid

Detailled

erDiagram
direction LR

    DEPT {
        number(2)    DEPTNO    PK
        varchar2(14) DNAME
        varchar2(13) LOC
    }

    EMP {
        number(4)    EMPNO     PK
        varchar2(10) ENAME
        varchar2(9)  JOB
        number(4)    MGR       FK
        date         HIREDATE
        number(7)    SAL
        number(7)    COMM
        number(2)    DEPTNO    FK
    }

    DEPT ||--o{ EMP : "has employees"
    EMP  ||--o{ EMP : "manages"
Loading

PK/FK Attributes Only

erDiagram
direction LR

    DEPT {
        number(2)    DEPTNO    PK
    }

    EMP {
        number(4)    EMPNO     PK
        number(4)    MGR       FK
        number(2)    DEPTNO    FK
    }

    DEPT ||--o{ EMP : "has employees"
    EMP  ||--o{ EMP : "manages"
Loading

Entities Only

erDiagram
direction LR
    DEPT ||--o{ EMP : "has employees"
    EMP  ||--o{ EMP : "manages"
Loading

Detailled with ELK Layout, handDrawn Look, neutral Theme

See

---
config:
   layout: elk
   look: handDrawn
   theme: neutral
--- 
erDiagram
direction LR

    DEPT {
        number(2)    DEPTNO    PK
        varchar2(14) DNAME
        varchar2(13) LOC
    }

    EMP {
        number(4)    EMPNO     PK
        varchar2(10) ENAME
        varchar2(9)  JOB
        number(4)    MGR       FK
        date         HIREDATE
        number(7)    SAL
        number(7)    COMM
        number(2)    DEPTNO    FK
    }

    DEPT ||--o{ EMP : "has employees"
    EMP  ||--o{ EMP : "manages"
Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment