FlowDiagram
Manufacturing & supply chainSQL DDL

Shipping & logistics schema template

Shipments, carriers and tracking events — a compact schema for a logistics tracking system. This data model has 7 tables and 29 columns, joined by 8 relationships. FlowDiagram draws it as an entity-relationship diagram with crow's-foot notation.

Open in the editor →
  • Free — no account, no trial, no watermark
  • Fully editable shapes and connectors, not a screenshot
  • Export PNG, SVG or PDF, or share it as a link
  • Private: the diagram never leaves your browser

Tables in this data model

  • customers — 2 columns
  • locations — 4 columns
  • carriers — 3 columns
  • shipments — 7 columns
  • packages — 4 columns
  • tracking_events — 5 columns
  • freight_invoices — 4 columns

How to use this ER diagram template

  1. Click Open in the editor. The ER diagram opens on a new page in FlowDiagram — nothing is uploaded and there is no sign-up.
  2. Rename, add or delete shapes and drag them where you want; connectors stay attached as things move.
  3. 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.
  4. Prefer text? Edit the SQL DDL below and paste it in through ☰ → Import / export SQL; the finished model exports back to DDL.
  5. 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 customers (
  customer_id INTEGER      NOT NULL PRIMARY KEY,
  name        VARCHAR(150) NOT NULL
);

CREATE TABLE locations (
  location_id INTEGER      NOT NULL PRIMARY KEY,
  name        VARCHAR(120) NOT NULL,
  kind        VARCHAR(20)  NOT NULL,
  country     CHAR(2)
);

CREATE TABLE carriers (
  carrier_id INTEGER      NOT NULL PRIMARY KEY,
  name       VARCHAR(120) NOT NULL,
  scac_code  VARCHAR(4)
);

CREATE TABLE shipments (
  shipment_id    INTEGER     NOT NULL PRIMARY KEY,
  customer_id    INTEGER     NOT NULL REFERENCES customers(customer_id),
  origin_id      INTEGER     NOT NULL REFERENCES locations(location_id),
  destination_id INTEGER     NOT NULL REFERENCES locations(location_id),
  carrier_id     INTEGER     NOT NULL REFERENCES carriers(carrier_id),
  service_level  VARCHAR(20),
  shipped_on     DATE
);

CREATE TABLE packages (
  package_id  INTEGER      NOT NULL PRIMARY KEY,
  shipment_id INTEGER      NOT NULL REFERENCES shipments(shipment_id),
  weight_kg   DECIMAL(8,2) NOT NULL,
  tracking_no VARCHAR(40)
);

CREATE TABLE tracking_events (
  event_id    INTEGER     NOT NULL PRIMARY KEY,
  package_id  INTEGER     NOT NULL REFERENCES packages(package_id),
  location_id INTEGER     REFERENCES locations(location_id),
  status      VARCHAR(60) NOT NULL,
  occurred_at TIMESTAMP   NOT NULL
);

CREATE TABLE freight_invoices (
  invoice_id  INTEGER       NOT NULL PRIMARY KEY,
  shipment_id INTEGER       NOT NULL REFERENCES shipments(shipment_id),
  amount      DECIMAL(12,2) NOT NULL,
  currency    CHAR(3)       NOT NULL
);

Related: ER diagram from SQL · All manufacturing & supply chain templates · All 521 templates