Use Cases /

Sales and Supply Networks

Use case · Trading, logistics and traceability

Sales and supply networks

A trading business is a network: suppliers provide products, customers place orders, employees sell and report to managers, shippers deliver.
Questions about traceability and performance follow those links: who supplied what a customer bought, who sold it, which products travel together.

Modeled as a graph, each of these questions is a path, and multi-step paths stay readable and fast.

  • Trace products from supplier to customer
  • Rank customers and employees by what they sold or bought
  • Walk the management chain, at any depth
  • Find the shortest connection between two people
1,104

nodes: customers, orders, products, suppliers, employees and more

4,909

edges, including order lines with quantity, price and discount

25

ready-to-run demo queries

See it in CoraDB

The questions, as queries.

Each query below runs as it is on the Northwind demo database.

-- Which suppliers provide products in the "Confections" category?
SELECT DISTINCT s.company_name
FROM MATCH (s:supplier)-[:supplies]->(p:product),
  (p:product)-[:part_of]->(c:category)
WHERE c.category_name = 'Confections';
graph pattern (PGQL)Traceability starts with a two-hop pattern.
Result6 rows, first 5 shown
company_name
Forêts d'érables
Heli Süßwaren GmbH & Co. KG
Karkki Oy
Pavlova, Ltd.
Specialty Biscuits, Ltd.
-- Who are the top 5 customers by total order value?
SELECT cu.company_name,
       SUM(oe.unit_price * oe.quantity * (1 - oe.discount)) AS totalValue
FROM MATCH (cu:customer)-[:purchased]->(o:`order`),
  (o:`order`)-[oe:orders]->(p:product)
GROUP BY cu.company_name
ORDER BY totalValue DESC
LIMIT 5;
graph pattern (PGQL)Order lines are edges with quantity, price and discount, aggregated with plain SQL.
Result5 rows
company_nametotalValue
QUICK-Stop110277.31
Ernst Handel104874.98
Save-a-lot Markets104361.95
Rattlesnake Canyon Grocery51097.80
Hungry Owl All-Night Grocers49979.91
-- Show the full management chain above employee "Robert King".
SELECT m.first_name, m.last_name
FROM MATCH (e:employee)-[:reports_to{1,3}]->(m:employee)
WHERE e.last_name = 'King';
graph pattern (PGQL)Variable-length paths: one to three levels up, no recursive SQL needed.
Result2 rows
first_namelast_name
StevenBuchanan
AndrewFuller
-- Find the shortest reporting connection between
-- "Robert King" and "Nancy Davolio".
SELECT k.first_name, k.last_name, n.first_name, n.last_name
FROM MATCH ANY_SHORTEST (k:employee)-[e:reports_to{1,4}]-(n:employee)
WHERE k.last_name = 'King' AND n.last_name = 'Davolio';
graph pattern (PGQL)Shortest-path search is part of the query language.
Result1 row
k.first_namek.last_namen.first_namen.last_name
RobertKingNancyDavolio

Why one engine

Operations data and its network, together.

Orders, invoices and stock levels are relational by nature; the network between suppliers, products, customers and people is a graph.
CoraDB keeps both in one engine, so a traceability question can start from an order table and follow the graph, in one statement and one transaction.

  • No ETL into a separate graph database
  • Graph results join straight to relational tables
  • The same drivers and tools for both

Try it yourself

Download the Northwind demo database, load it into CoraDB and run the queries.
The Getting Started guide shows how, step by step.

Get the Northwind database

Want to try it on your own data? Talk to us.