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.
- ER diagram for a hospital management system8 tables · 10 relationships. Patients are admitted to wards, seen by doctors who belong to departments, book appointments, receive prescriptions and are billed.
- ER diagram for a library management system9 tables · 9 relationships. A library catalogues books (titles) and the physical copies on its shelves, lends copies to members, takes reservations and charges fines.
- ER diagram for a banking system7 tables · 8 relationships. Customers hold accounts at branches (some accounts are joint), money moves through transactions, and customers take out loans.
- ER diagram for a college management system7 tables · 8 relationships. Departments run courses, courses are offered as sections each term and taught by faculty, students enrol in sections and receive grades.
- ER diagram for a hotel management system7 tables · 6 relationships. Guests book reservations for one or more rooms, rooms have a type that sets the nightly rate, stays generate charges and payments.
- ER diagram for a student management system8 tables · 7 relationships. A school records students, their guardians, classes and subjects, daily attendance and exam marks.
- ER diagram for a online shopping system8 tables · 9 relationships. An e-commerce store: customers with saved addresses, products in categories, carts, orders with line items, payments and shipments.
- ER diagram for a employee management system7 tables · 8 relationships. An HR database: employees in departments, a manager hierarchy, job titles with salary history, projects staffed by several people, and leave requests.
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
- ER Diagram GeneratorPaste CREATE TABLE statements or DBML and get a draggable crow’s-foot diagram.
- Crow’s Foot NotationER diagram symbols and a cardinality builder that reads relationships aloud.
- Database NormalizationStep one messy table through 1NF, 2NF and 3NF.
- Mermaid ER DiagramTurn a SQL schema into Mermaid erDiagram code for GitHub, GitLab and Notion.