Tables in this data model
- stores — 4 columns
- employees — 4 columns
- products — 4 columns
- store_inventory — 4 columns
- customers — 3 columns
- sales — 6 columns
- sale_lines — 5 columns
How to use this ER diagram template
- Click Open in the editor. The ER diagram opens on a new page in FlowDiagram — nothing is uploaded and there is no sign-up.
- Rename, add or delete shapes and drag them where you want; connectors stay attached as things move.
- Drop in vendor logos from the library — 1,160 of them, including every AWS, Azure and Google Cloud service icon — or restyle it with the colour and theme controls.
- Prefer text? Edit the DBML below and paste it in through ☰ → Import diagram; the finished model exports to SQL DDL or back to DBML.
- Export to PNG, SVG or PDF, or press Ctrl+L for a link that carries the whole diagram.
DBML source
The whole template is the text below. Paste it into FlowDiagram, keep it in Git next to the code it describes, or hand it to an AI assistant to extend.
Table stores {
id integer [pk]
name varchar
city varchar
opened_on date
}
Table employees {
id integer [pk]
store_id integer [ref: > stores.id]
name varchar
role varchar
}
Table products {
id integer [pk]
sku varchar [unique]
name varchar
price decimal
}
Table store_inventory {
id integer [pk]
store_id integer [ref: > stores.id]
product_id integer [ref: > products.id]
on_hand integer
}
Table customers {
id integer [pk]
loyalty_no varchar [unique]
email varchar
}
Table sales {
id integer [pk]
store_id integer [ref: > stores.id]
employee_id integer [ref: > employees.id]
customer_id integer [ref: > customers.id]
sold_at timestamp
total decimal
}
Table sale_lines {
id integer [pk]
sale_id integer [ref: > sales.id]
product_id integer [ref: > products.id]
quantity integer
unit_price decimal
}
Related: Database schema diagram tool · All retail & e-commerce operations templates · All 521 templates