Tables, keys, and cardinality
This page is the ER diagram generator. It draws entities as tables, marks keys, and shows cardinality between them. Use it to agree a relational shape before you write migrations.
A class diagram is the neighbor for attributes, methods, and inheritance in code. If you need operations on objects, use that page. Stay here for data: entities, keys, and how many rows relate.
Stay on the ER generator
Pick this ER diagram when the question is which tables exist and how they join. Pick a class diagram when the question is which types own which methods. Do not maintain two drawings for the same decision.
Check keys and counts first
1. Mark the primary key
Every entity needs a primary key in the prompt. If the draft omitted one, add it in the editor before you discuss foreign keys.
2. Read cardinality out loud
A customer places many orders, and an order belongs to one customer. If the draft reversed that, fix the markers.
3. Drop methods
Behavior such as calculateTax is a class method. Remove it from the ER draft so the diagram stays a data model.
How to phrase the prompt
List each entity, its important columns, and which column is the key. Then write one sentence per relationship with both counts, such as one order contains many lines. Name join tables when a link has its own columns.
ER draft questions
- Is this a different product from the ER generator?
- No. This is the ER diagram page. You describe tables and relationships, and the draft is an ER diagram you edit as Mermaid.
- Should every column appear?
- No. Keep keys, foreign keys, and columns that change the relationship. Leave audit fields off until the shape is stable.
- What if two entities share a many-to-many link?
- Say so in the prompt, and name the link table if it stores anything besides the two keys. Then confirm both cardinalities on the draft.