Entity Relationship Diagrams
What are Entity Relationship Diagrams?
Mermaid's Entity Relationship Diagrams (ERDs) help you visualize database structures and relationships. For analytics engineers, they're essential for documenting data models, table relationships, and database schemas. ERDs show how different entities (tables) in your database relate to each other, including their attributes and the nature of their relationships.
Creating Your First ERD
Launch DinoAI: From Code IDE, access DinoAI to start creating diagrams.
Use a Simple Prompt: Tell DinoAI what kind of ERD you want to create. For example:
- "Create a mermaid ERD diagram showing the relationships between my customer, order, and product tables"
- "Generate a mermaid ERD for my e-commerce data model with proper cardinality notation"
- "Build a mermaid ERD diagram for my dbt models showing table relationships and key columns"
Get Your Diagram: DinoAI will generate a complete
.mmd
file with proper Mermaid syntax.Preview Your Work: Click the eye icon (👁️) to preview your diagram in real-time as you edit.
Iterate and Refine: Modify the generated
.mmd
file directly, or ask DinoAI to make specific changes.
Example
---
title: Order example
---
erDiagram
CUSTOMER ||--o{ ORDER : places
ORDER ||--|{ LINE-ITEM : contains
CUSTOMER }|..|{ DELIVERY-ADDRESS : uses

Reusable ERD prompts for you and your team
You can create custom, standardized .dinoprompts for Mermaid's ERDiagrams that ensure consistency across your data team. See step-by-step guide.
Diagram Syntax Guide
Basic Entity Definition
erDiagram
FACT_TABLE {
string order_id PK
timestamp created_at
decimal amount
}
Cardinality Notation
Show relationships between entities using crow's foot notation:
||--||
: Exactly one to exactly one||--o{
: One to many (zero or more)||--|{
: One to many (one or more)}o--o{
: Many to many
Relationship Types
Solid lines (--): Identifying relationship
Dotted lines (..): Non-identifying relationship
Best Practices
Use clear, descriptive entity names
Show only relevant attributes
Include key relationships
Use consistent naming conventions
Document primary and foreign keys
Group related entities together
Additional Resources
For more syntax options and advanced features, visit the official Mermaid documentation
Last updated
Was this helpful?