TGViewer
SQL Programming Resources SQL Programming Resources @sqlanalyst ยท 76.7K subscribers
Post #2656 1.63K
๐Ÿš€ SQL Project Series #31: Supply Chain & Procurement Analytics ๐Ÿšš

Analyze suppliers, purchase orders, deliveries, procurement costs, and supplier performance using SQL to identify cost-saving opportunities and improve supply chain efficiency.

๐ŸŽฏ Business Objectives

โœ… Analyze purchase orders

โœ… Track supplier performance

โœ… Measure procurement spending

โœ… Identify delayed deliveries

โœ… Analyze purchase costs

โœ… Monitor order fulfillment

โœ… Evaluate supplier quality

โœ… Identify cost-saving opportunities

๐Ÿ“‚ Step 1: Create Database

CREATE DATABASE procurement_db;
USE procurement_db;


๐Ÿ“‚ Step 2: Create Suppliers Table

CREATE TABLE suppliers (
supplier_id INT PRIMARY KEY,
supplier_name VARCHAR(100),
city VARCHAR(50),
supplier_category VARCHAR(50)
);


๐Ÿ“‚ Step 3: Create Products Table

CREATE TABLE products (
product_id INT PRIMARY KEY,
product_name VARCHAR(100),
category VARCHAR(50),
standard_cost DECIMAL(10,2)
);


๐Ÿ“‚ Step 4: Create Purchase Orders Table

CREATE TABLE purchase_orders (
po_id INT PRIMARY KEY,
supplier_id INT,
po_date DATE,
expected_date DATE,
actual_delivery_date DATE,
po_status VARCHAR(30),
FOREIGN KEY (supplier_id)
REFERENCES suppliers(supplier_id)
);


๐Ÿ“‚ Step 5: Create Purchase Order Items Table

CREATE TABLE purchase_order_items (
po_item_id INT PRIMARY KEY,
po_id INT,
product_id INT,
quantity INT,
unit_cost DECIMAL(10,2),
FOREIGN KEY (po_id)
REFERENCES purchase_orders(po_id),
FOREIGN KEY (product_id)
REFERENCES products(product_id)
);


๐Ÿ“‚ Step 6: Insert Sample Suppliers

INSERT INTO suppliers VALUES
(1,'ABC Suppliers','Mumbai','Electronics'),
(2,'Global Traders','Delhi','Office Supplies'),
(3,'Prime Distributors','Pune','Electronics'),
(4,'Reliable Wholesale','Bangalore','Furniture'),
(5,'Metro Supplies','Hyderabad','General');


๐Ÿ“‚ Step 7: Insert Sample Products

INSERT INTO products VALUES
(101,'Laptop','Electronics',55000),
(102,'Monitor','Electronics',15000),
(103,'Keyboard','Accessories',1200),
(104,'Office Chair','Furniture',6500),
(105,'Printer','Office Equipment',18000);


๐Ÿ“‚ Step 8: Insert Sample Purchase Orders

INSERT INTO purchase_orders VALUES
(1001,1,'2025-01-05','2025-01-10','2025-01-09','Delivered'),
(1002,2,'2025-01-07','2025-01-12','2025-01-15','Delivered'),
(1003,3,'2025-01-10','2025-01-18','2025-01-22','Delayed'),
(1004,4,'2025-01-12','2025-01-20','2025-01-19','Delivered'),
(1005,5,'2025-01-15','2025-01-25',NULL,'Pending');


๐Ÿ“‚ Step 9: Insert Sample Purchase Order Items

INSERT INTO purchase_order_items VALUES
(1,1001,101,20,54000),
(2,1001,102,30,14500),
(3,1002,103,100,1100),
(4,1003,101,15,53500),
(5,1003,105,10,17500),
(6,1004,104,40,6200),
(7,1005,105,20,17200);
  • โค 1
  • ๐Ÿ‘ 1
More from @sqlanalyst
  1. Oct 8, 2026๐ŸŽ“ ๐— ๐—ถ๐—ฐ๐—ฟ๐—ผ๐˜€๐—ผ๐—ณ๐˜ ๐—™๐—ฅ๐—˜๐—˜ ๐—–๐—ผ๐˜‚๐—ฟ๐˜€๐—ฒ๐˜€ ๐˜„๐—ถ๐˜๐—ต ๐—–๐—ฒ๐—ฟ๐˜๐—ถ๐—ณ๐—ถ๐—ฐ๐—ฎ๐˜๐—ฒ๐˜€! ๐Ÿš€๐Ÿ”ฅ Upgrโ€ฆ
  2. Oct 7, 2026๐Ÿš€๐—ฃ๐—ฎ๐˜† ๐—”๐—ณ๐˜๐—ฒ๐—ฟ ๐—ฃ๐—น๐—ฎ๐—ฐ๐—ฒ๐—บ๐—ฒ๐—ป๐˜ ๐—ง๐—ฟ๐—ฎ๐—ถ๐—ป๐—ถ๐—ป๐—ด | ๐—•๐—ฒ๐—ฐ๐—ผ๐—บ๐—ฒ ๐—ฎ ๐—™๐˜‚๐—น๐—น๐˜€๐˜๐—ฎ๐—ฐโ€ฆ
  3. Oct 7, 2026SQL Interview Series โ€” Part 4 ๐Ÿ“Œ Question 4: Find the Highest Salary in Each Department Suโ€ฆ
  4. Oct 7, 2026๐— ๐—ฎ๐˜€๐˜๐—ฒ๐—ฟ ๐—ฃ๐—ผ๐˜„๐—ฒ๐—ฟ ๐—•๐—œ ๐—ณ๐—ผ๐—ฟ ๐—™๐—ฅ๐—˜๐—˜! ๐Ÿ”ฅ Learn Power BI through these FREE learninโ€ฆ
  5. Sep 29, 2026SQL Interview Series โ€” Part 2 ๐Ÿ“Œ Question 2: Find Duplicate Records Suppose you have an Emโ€ฆ
  6. Sep 29, 2026๐—™๐—ฅ๐—˜๐—˜ ๐—ฅ๐—ฒ๐˜€๐—ผ๐˜‚๐—ฟ๐—ฐ๐—ฒ๐˜€ ๐—ง๐—ผ ๐—Ÿ๐—ฒ๐—ฎ๐—ฟ๐—ป ๐—”๐—œ ๐—ถ๐—ป ๐Ÿฎ๐Ÿฌ๐Ÿฎ๐Ÿฒ๐Ÿš€ โ€‹ Explore 6 free resourceโ€ฆ
Threads Profile ViewerView any public Threads profile without an account.Open ThreadLook โ†’Writing with AI? Make it sound human.Metric37 rewrites AI drafts so they read naturally. Free AI detector, 1,500 words free.Try Metric37 โ†’