Mermaid ER Crowfoot relationships

Mermaid Full Examples with Code and Descriptions:

1:1 Relationship

erDiagram
Person {
int PersonID PK
}

Passport {
int PassportID PK
}

Person ||--|| Passport : "owns"
  • Description: One Person has one Passport, and one Passport is assigned to one Person.

1:N Relationship

erDiagram
Customer {
int CustomerID PK
}

Order {
int OrderID PK
int CustomerID FK
}

Customer ||--o{ Order : "places"
  • Description: A Customer can place many Orders, but each Order belongs to exactly one Customer.

M:N Relationship

erDiagram
Student {
int StudentID PK
}

Course {
int CourseID PK
}

Enrollment {
int EnrollmentID PK
int StudentID FK
int CourseID FK
}

Student o{--o{ Enrollment : "enrolls in"
Course o{--o{ Enrollment : "has"
  • Description: A Student can enroll in many Courses, and a Course can have many Students. This relationship is managed via the junction table Enrollment.

This table and examples illustrate how to represent all major relationship types using Mermaid with crow’s foot notation!

Scroll to Top