Skip to content
whiteboard.tools

E-commerce database ER diagram template

Customers, orders, order items, products and payments, generated from SQL.

Use this template
customersid bigint PKemail varchar(255)name varchar(120)created_at timestampproductsid bigint PKsku varchar(64)name varchar(200)price_cents intordersid bigint PKcustomer_id bigint FKstatus varchar(20)placed_at timestamporder_itemsid bigint PKorder_id bigint FKproduct_id bigint FKquantity intunit_price_cents intpaymentsid bigint PKorder_id bigint FKamount_cents intprovider varchar(40)paid_at timestampcustomer_idorder_idproduct_idorder_id
E-commerce database ER diagram template. Every shape, label and arrow is editable once it is on your board.

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.

Further reading