DiagramDB / ER Diagram Examples

ER Diagram Examples

Eight complete database designs drawn in crow’s-foot notation. Each one comes with runnable CREATE TABLE SQL and a plain-English reason for every relationship line, and opens in the ER diagram generator for editing.

What the examples have in common

Almost every business system needs the same three patterns, and spotting them is most of the work of database design:

  • One-to-many, drawn as a bar at the parent and a crow’s foot at the child: a department has many doctors. The foreign key goes in the child table.
  • Many-to-many, resolved into a junction table with a composite primary key: books and authors, students and sections, orders and products. The junction table is also where attributes of the pairing live (a grade, a quantity, an agreed rate).
  • History as rows: loans, admissions, salaries and payments are separate tables with dates instead of columns that get overwritten, so the past is never lost.

The symbols themselves are explained on the crow’s foot notation page, and if a table in your own design repeats groups of columns, the normalization walkthrough shows how to split it.

Questions

What should an ER diagram example include?

Every entity as a table with its attributes, a primary key per table, foreign keys for each relationship, and the cardinality at both ends of every line (one, many, optional). Many-to-many relationships should appear as junction tables in a physical diagram.

Can I edit these ER diagrams?

Yes. Each example opens in the ER diagram generator, where you can change the SQL, drag tables, and export SVG, PNG, Mermaid, DBML or SQL for PostgreSQL, MySQL, SQL Server or SQLite.

Are these ER diagrams in crow’s foot or Chen notation?

Crow’s foot, the notation used by most database tools. If your course asks for Chen notation, the entities and relationships are the same: draw each junction table as a diamond relationship with its own attributes.

Is the SQL valid for MySQL and PostgreSQL?

The statements use portable types (INT, VARCHAR, DATE, TIMESTAMP, DECIMAL) that run on MySQL, MariaDB, PostgreSQL and SQLite. For SQL Server, swap BOOLEAN for BIT and TIMESTAMP for DATETIME2, or use the export’s SQL Server target.

Related tools