# Mermaid ER diagram in Markdown to PDF

Entities with typed attributes and key markers are joined by relationships with crow's-foot cardinalities.

Crow's-foot cardinalities, identifying and non-identifying relationships, and typed attribute blocks with key markers, for an airline booking model.

- PDF: https://legivel.com/examples/mermaid-diagrams/er-diagram.pdf
- Page: https://legivel.com/examples/mermaid-diagrams/er-diagram
- Open in the editor: https://legivel.com/markdown-to-pdf?sample=mermaid-er
- More mermaid diagrams in Markdown to PDF: https://legivel.com/examples/mermaid-diagrams

## Markdown source

````markdown
# Entity relationship diagrams

```mermaid
erDiagram
    PASSENGER ||--o{ BOOKING : makes
    BOOKING ||--|{ TICKET : contains
    TICKET }o--|| FLIGHT : "is for"
    FLIGHT }o--|| AIRCRAFT : "operated with"
    FLIGHT }o--|| AIRPORT : "departs from"
    FLIGHT }o--|| AIRPORT : "arrives at"
    TICKET |o--o| SEAT : "assigned"

    PASSENGER {
        string passenger_id PK
        string full_name
        string passport_no UK "as printed"
        date date_of_birth
        string nationality
    }
    BOOKING {
        string record_locator PK "six letters"
        string passenger_id FK
        timestamp booked_at
        string currency
        decimal total
    }
    TICKET {
        string ticket_no PK "13 digits"
        string record_locator FK
        string flight_no FK
        string fare_class
        int bag_allowance_kg
    }
    FLIGHT {
        string flight_no PK
        date flight_date PK
        string origin FK
        string destination FK
        time departure_local
        int duration_min
    }
    AIRPORT {
        string iata PK "three letters"
        string name
        string city
        string country
        string timezone
    }
    SEAT {
        string flight_no FK
        string seat PK "row and letter"
        boolean exit_row
    }
```
````
