ER diagram examples
14 database schemas, each drawn by ErdDocs as an interactive ER diagram with the SQL to copy. Every domain teaches a different modeling pattern, so find the one closest to your assignment or project.
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 five 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, with 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, and 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, and tables assigned at seating, not booking.
- Northwind Database ER diagram
Teaches: natural keys, a self-referencing org chart and a foreign key named ship_via.
- AdventureWorks Database ER diagram
Teaches: a supertype table shared by people, stores and vendors, and Microsoft’s own column notes.
- Sakila Database ER diagram
Teaches: a foreign-key cycle between staff and store, and a search copy kept in sync by triggers.
- Chinook Database ER diagram
Teaches: two foreign keys into one table with nothing in the names to say so, and prices frozen at sale.
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 to describe 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. Each is small enough to read in a sitting. Each is 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. You can also paste a Prisma schema, DBML, Mermaid, PlantUML, or Django, SQLAlchemy, Sequelize or TypeORM models. The format is detected from what you paste. Nothing is uploaded: the parsing happens in your browser.
Which example should I start with?
Start with the blog schema if you want every relationship type in five tables. Take the e-commerce one if you need a junction table that carries its own data. If your problem is really about time, take the hotel or library schema. Bookings, loans and availability are where beginners most often model a query as a column. For a database you will meet in a SQL course, start with Northwind or Chinook. For one shaped like a real company, take AdventureWorks.
Have your own schema instead? Paste it on the home page: same tool, your tables. For the printable reference document, use the data dictionary generator.