E-commerce database ER diagram template
Customers, orders, order items, products and payments, generated from SQL.
About this template
An online shop is the textbook relational schema: customers place orders, orders contain line items, line items point at products, and payments settle orders. This entity-relationship diagram shows those five tables with their keys.
The diagram is generated from the CREATE TABLE statements below it. Open the SQL in the ER diagram generator, add your columns or tables, and the picture updates as you type.
What is in the diagram
- orders → customers
- Each order belongs to one customer through customer_id.
- order_items
- The join between orders and products. It stores quantity and the price at the time of purchase.
- payments → orders
- Kept separate from orders so one order can have several payment attempts.