ER diagram examples
11 database schemas, each rendered as an interactive ER diagram with the SQL to copy. They are not the same shop over and over: every domain teaches a different modeling pattern — find the one your assignment or your project is secretly about.
New to the notation? ER diagram explains what the boxes and line ends mean before you copy anything.
- E-commerce Store ER diagram
Teaches: junction tables with payload, self-referencing categories, frozen prices.
- Blog Platform ER diagram
Teaches: every relationship type in seven tables — the classic first schema.
- School Management System ER diagram
Teaches: the course/section split and composite-key attendance.
- Hospital Management System ER diagram
Teaches: two event tables instead of one "visits" catch-all.
- Library Management System ER diagram
Teaches: the book-versus-copy split; loans and reservations on different levels.
- Hotel Management System ER diagram
Teaches: date-range booking and why availability is a query, not a column.
- Banking System ER diagram
Teaches: two foreign keys into one table; append-only ledgers.
- Inventory Management System ER diagram
Teaches: running totals plus movement history, reconciled.
- CRM ER diagram
Teaches: pipeline stages as data, and the company/contact/deal triangle.
- Restaurant Management System ER diagram
Teaches: a bill-of-materials recipe junction; tables assigned at seating, not booking.
- Northwind Database ER diagram
Teaches: .
Questions before you copy one
What are the main types of database schema?
Four names come up: flat (one table, no relations), hierarchical (a strict parent-child tree), network (a record may have several parents) and relational (tables joined by keys). Every example below is relational, because that is what PostgreSQL, MySQL, SQL Server and SQLite are — the other three are mostly history, or a way of describing document and graph databases that are not built from tables at all.
Can I use these schemas in my own project or assignment?
Yes. Each page gives the SQL in full, and it runs as written on PostgreSQL. They are teaching schemas rather than production ones: small enough to read in a sitting, and each built around one modeling decision worth copying — or worth arguing with, which is just as useful in an assignment.
How do I turn one of these into a diagram of my own database?
Replace the SQL. Export your schema with pg_dump --schema-only or mysqldump --no-data and paste it over the example — or paste a Prisma schema, DBML, Mermaid, PlantUML, or Django, SQLAlchemy, Sequelize or TypeORM models. The format is detected from what you paste, and nothing is uploaded: the parsing happens in your browser.
Which example should I start with?
The blog schema if you want every relationship type in seven tables, the e-commerce one if you need a junction table that carries its own data, and the hotel or library schema if your problem is really about time — bookings, loans and availability are where beginners most often model a query as a column.
Have your own schema instead? Paste it on the home page — same tool, your tables. Need the printable reference document, not the picture? That is the data dictionary generator.