Entity Relationship Diagrams

이제 draw.io로 ERD 그만 그리자...

Example

erDiagram으로 시작한다.

Code
---
title: Order example
---
erDiagram
    CUSTOMER ||--o{ ORDER : places
    ORDER ||--|{ LINE-ITEM : contains
    CUSTOMER }|..|{ DELIVERY-ADDRESS : uses
Code
erDiagram
    CUSTOMER ||--o{ ORDER : places
    CUSTOMER {
        string name
        string custNumber
        string sector
    }
    ORDER ||--|{ LINE-ITEM : contains
    ORDER {
        int orderNumber
        string deliveryAddress
    }
    LINE-ITEM {
        string productCode
        int quantity
        float pricePerUnit
    }

Syntax

    <first-entity> [<relationship> <second-entity> : <relationship-label>]
  • first-entity is the name of an entity. Names must begin with an alphabetic character and may also contain digits, hyphens, and underscores.

  • relationship describes the way that both entities inter-relate. See below.

  • second-entity is the name of the other entity.

  • relationship-label describes the relationship from the perspective of the first entity.

Relationship Syntax

Value (left)Value (right)Meaning

|o

o|

Zero or one

||

||

Exactly one

}o

o{

Zero or more (no upper limit)

}|

|{

One or more (no upper limit)

Value (left)Value (right)Alias for

one or zero

one or zero

Zero or one

zero or one

zero or one

Zero or one

one or more

one or more

One or more

one or many

one or many

One or more

many(1)

many(1)

One or more

1+

1+

One or more

zero or more

zero or more

Zero or more

zero or many

zero or many

Zero or more

many(0)

many(1)

Zero or more

0+

0+

Zero or more

only one

only one

Exactly one

1

1

Exactly one

My Thoughts

슬슬 귀찮아서 대충 정리하는 게 보이는가...? 그렇다면 정확하게 봤다.

사실 ERD는 정리할 것도 없이 너무 간단한다.

REF

Last updated