Example data models
Each example is a complete, validated data model you can read here or open in EntityModel.com and change. Every page has the ER diagram, the entity and attribute dictionary, the relationships, reference data with values, PostgreSQL DDL and a Mermaid diagram.
| Example | What it covers |
|---|---|
| E-commerce store | Customers, addresses, a category tree, products, carts, orders, payments and shipments |
| CRM | Accounts with parent companies, contacts, leads, an opportunity pipeline, quoted products and activities |
| Human resources | Employees and their reporting line, departments, jobs and positions, salary history, leave and reviews |
| Library management | Books and authors (many-to-many), copies at branches, members, loans, holds and fines |
| Hospital management | Patients, doctors, appointments, admissions to wards and beds, diagnoses, prescriptions and invoices |
| Student enrollment | Students, programs, courses with prerequisites, sections in terms, instructors and graded enrollments |
| SaaS subscription billing | Organizations, plans and prices, subscriptions with seat and metered items, usage, invoices and payments |
| Star schema (retail sales) | A sales fact at order-line grain with date, product, store, customer (SCD type 2) and promotion dimensions |
| Data Vault 2.0 | Hubs, links and satellites for customers, products and orders, with hash keys and load metadata |
How to use an example
- Open the example's page and click Open this model in EntityModel.com. The whole model is in the link, so nothing is uploaded; the app offers to open a copy in your browser.
- Rename, add and remove entities to fit your domain. Validation keeps keys, references and relationships consistent as you go.
- Derive a physical model for your database, then export SQL DDL, dbt tests or a PDF design document. See Derive, compare and migrate tabs and Export SQL DDL.
You can also download each example's model.json and open it with Open model file, or use it with the command-line tool.
How the examples are modeled
The examples follow the practices in How to design a data model:
- singular
snake_casenames, surrogate primary keys ending in_id, and natural identifiers (email, SKU, ISBN) marked unique; - every coded value (status, type, country) as a reference list with its values, so it becomes a lookup table, a foreign key and a dbt
accepted_valuestest; - relationships named in both directions, with the foreign key column recorded;
- personal data flagged as PII;
- money as
DECIMAL, and history kept where it matters (prices on order lines, salary effective dates).