Tables in this data model
- hub_customer — 4 columns
- hub_order — 4 columns
- hub_product — 4 columns
- link_customer_order — 4 columns
- link_order_product — 4 columns
- sat_customer_details — 5 columns
- sat_order_status — 4 columns
- sat_product_price — 4 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 SQL DDL below and paste it in through ☰ → Import / export SQL; the finished model exports back to DDL.
- Export to PNG, SVG or PDF, or press Ctrl+L for a link that carries the whole diagram.
SQL DDL 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.
CREATE TABLE hub_customer (
customer_hk CHAR(32) NOT NULL PRIMARY KEY,
customer_bk VARCHAR(50) NOT NULL,
load_dts TIMESTAMP NOT NULL,
record_source VARCHAR(50) NOT NULL
);
CREATE TABLE hub_order (
order_hk CHAR(32) NOT NULL PRIMARY KEY,
order_bk VARCHAR(50) NOT NULL,
load_dts TIMESTAMP NOT NULL,
record_source VARCHAR(50) NOT NULL
);
CREATE TABLE hub_product (
product_hk CHAR(32) NOT NULL PRIMARY KEY,
product_bk VARCHAR(50) NOT NULL,
load_dts TIMESTAMP NOT NULL,
record_source VARCHAR(50) NOT NULL
);
CREATE TABLE link_customer_order (
customer_order_hk CHAR(32) NOT NULL PRIMARY KEY,
customer_hk CHAR(32) NOT NULL REFERENCES hub_customer(customer_hk),
order_hk CHAR(32) NOT NULL REFERENCES hub_order(order_hk),
load_dts TIMESTAMP NOT NULL
);
CREATE TABLE link_order_product (
order_product_hk CHAR(32) NOT NULL PRIMARY KEY,
order_hk CHAR(32) NOT NULL REFERENCES hub_order(order_hk),
product_hk CHAR(32) NOT NULL REFERENCES hub_product(product_hk),
load_dts TIMESTAMP NOT NULL
);
CREATE TABLE sat_customer_details (
customer_hk CHAR(32) NOT NULL REFERENCES hub_customer(customer_hk),
load_dts TIMESTAMP NOT NULL,
hash_diff CHAR(32) NOT NULL,
name VARCHAR(150),
email VARCHAR(255)
);
CREATE TABLE sat_order_status (
order_hk CHAR(32) NOT NULL REFERENCES hub_order(order_hk),
load_dts TIMESTAMP NOT NULL,
hash_diff CHAR(32) NOT NULL,
status VARCHAR(20)
);
CREATE TABLE sat_product_price (
product_hk CHAR(32) NOT NULL REFERENCES hub_product(product_hk),
load_dts TIMESTAMP NOT NULL,
hash_diff CHAR(32) NOT NULL,
list_price DECIMAL(10,2)
);
Related: Database schema diagram tool · ER diagram from SQL · All database & er models templates · All 521 templates