Crow’s Foot ER Notation Using Mermaid

1. Introduction to Crow’s Foot Notation

Crow’s Foot Notation is a graphical representation used in Entity-Relationship Diagrams (ERD) to illustrate relationships between entities in a relational database. This notation uses symbols to describe the cardinality (one-to-one, one-to-many, many-to-many) and participation (mandatory or optional) of entities in a database.


2. Crow’s Foot Symbols

Crow’s Foot Notation uses different visual indicators for relationships:

SymbolMeaning
Two linesOne (mandatory). Each instance must be in a relationship once
Line and circleZero or One (optional). Each instance can be related to zero or one entities
CrowFeetMANY. Each element related zero, one or many

Mermaid Example: Crow’s Foot Symbols

erDiagram
A ||--|| B : "One-to-One (Mandatory)"
C |O--|| D : "Zero or One"
E ||--o{ F : "One to Many"
G O{--|| H : "Many to One (Optional)"
I O{--o{ J : "Many to Many"

3. Relationship Types with Crow’s Foot Notation

Here are the different relationship types with examples.

3.1 One-to-One (1:1) Relationship

Each entity is related to only one entity in the other table.

Example: Each Person has one Passport, and each Passport is assigned to one Person.

erDiagram
Person ||--|| Passport : "owns"

3.2 One-to-Many (1:N) Relationship

One entity is related to many entities in the other table.

Example: A Customer can place many Orders, but each Order belongs to only one Customer.

erDiagram
Customer ||--o{ Order : "places"

3.3 Many-to-Many (M:N) Relationship

Each entity can be associated with many records in the other table. This requires an intermediate table (junction table).

Example: A Student can enroll in many Courses, and a Course can have many Students.

erDiagram
Student {
int StudentID PK
string Name
}

Course {
int CourseID PK
string CourseName
}

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

Student o{--o{ Enrollment : "enrolls in"
Course o{--o{ Enrollment : "has"

4. Mandatory vs. Optional Relationships

Participation constraints define whether an entity is required to have a related entity.

4.1 Mandatory Relationships

An entity must participate in the relationship.

Example: Every Order must have an associated Customer.

erDiagram
Customer ||--o{ Order : "places (mandatory)"

4.2 Optional Relationships

An entity may or may not participate in the relationship.

Example: A Customer may place Orders, but they might not have placed any yet.

erDiagram
Customer |O--o{ Order : "places (optional)"

5. Conclusion

Crow’s Foot Notation is a powerful way to visualize relationships in database design. Mermaid provides an easy-to-use syntax for creating ER diagrams that clearly illustrate cardinality and participation constraints.

Scroll to Top