Templates / E-commerce
E-commerce Database Schema (ERD Template)
A ready-to-use e-commerce database schema: customers place orders, orders contain items that reference a product catalog organized by category, and payments settle orders. Foreign keys carry explicit ON DELETE rules — order items cascade with their order, while products can't be deleted while orders reference them.
Tables
| Table | Purpose |
|---|---|
customers | Shopper accounts with unique emails |
categories | Product catalog grouping |
products | Sellable items with price and stock |
orders | One checkout per row, status-tracked |
order_items | Order ↔ product line items |
payments | Settlements against an order |
Schema highlights
- ON DELETE CASCADE on order_items and payments — removing an order cleans up its children
- ON DELETE RESTRICT on product references — no silent catalog loss
- Covering indexes on every foreign key used for lookups
- Ships with a starter glossary and Email / Money / Status Code domains — naming compliance starts at 100%
How to use it
- Click Open in Sqemo — the template loads as a new local project (nothing is uploaded, no account needed).
- Rename entities and attributes; physical names follow your glossary and naming rules automatically.
-
Export
CREATE TABLESQL for MySQL, PostgreSQL, SQL Server, Oracle, SQLite, H2, or CUBRID — or DBML.
Prefer your own baseline? Import SQL or DBML and Sqemo builds the diagram, foreign keys included.