What is an ER diagram?
An entity relationship diagram, or ER diagram, shows the things a system stores (entities), their attributes and how they relate. Peter Chen introduced the idea in 1976. Today most teams use crow's foot notation, where the ends of each line show how many records can be on each side: one or many, optional or required.
What is in the template
- users: the people using the system.
- projects: each one led by a user.
- issues: each one belongs to a project and may be assigned to a user.
- Relations: "leads" between users and projects, "assigned" between users and issues, and the link from each project to its issues.
How to design a schema with it
- List the entities, the nouns of your domain, as tables.
- Give every table a primary key, and mark foreign keys where tables refer to each other.
- Draw the relations and set the cardinality at both ends.
- Check many to many relations: each one needs a join table in a relational database.
- Walk through a real use case and make sure every piece of data has a home.
Tips
- Name tables and columns the way the code does, so the diagram and the database match.
- Draw one diagram per area of the system rather than one huge schema.
- Embed the diagram in the issue that changes the schema, so reviewers see the design next to the change.
Use this template in Starlex
Open a project, go to Notes, then Diagrams, choose New diagram and pick Entity relationship. To add it to a diagram you already have, use Insert, then From template.
- More than a hundred shapes, with connectors that stay attached when you move things.
- Pages and layers for large diagrams, and automatic tree, grid and circle layouts.
- Import draw.io files and Mermaid flowcharts, and export to PNG, SVG or draw.io.
- Embed the diagram in an issue or a note, where it always shows the latest version.
Frequently asked questions
What is crow's foot notation?
A way of drawing relations where the end of each line shows the cardinality: a single bar for one, a three pronged crow's foot for many, and a circle for optional.
What is the difference between an ER diagram and a UML class diagram?
An ER diagram models stored data and how it relates. A UML class diagram models classes in code, with their methods and inheritance.
Can I export the ER diagram?
Yes, as a PNG, an SVG, a draw.io file or Starlex JSON.
