TGViewer
SQL Programming Resources SQL Programming Resources @sqlanalyst ยท 76.7K subscribers
Post #2628 3.64K
๐Ÿš€ SQL Project Series #19

Logistics & Shipment Analytics ๐Ÿ“ฆ

Analyze shipments, warehouses, delivery performance, customers, and transportation data using SQL to optimize supply chain operations and improve delivery efficiency.

๐ŸŽฏ Business Objectives
โœ… Track shipments
โœ… Monitor delivery performance
โœ… Analyze warehouse operations
โœ… Measure transportation efficiency
โœ… Identify delayed deliveries
โœ… Optimize shipping costs
โœ… Analyze customer orders
โœ… Build logistics dashboards

๐Ÿ“‚ Step 1: Create Database
CREATE DATABASE logistics_db;
USE logistics_db;

๐Ÿ“‚ Step 2: Create Customers Table
CREATE TABLE customers (
customer_id INT PRIMARY KEY,
customer_name VARCHAR(100),
city VARCHAR(50)
);

๐Ÿ“‚ Step 3: Create Warehouses Table
CREATE TABLE warehouses (
warehouse_id INT PRIMARY KEY,
warehouse_name VARCHAR(100),
city VARCHAR(50)
);

๐Ÿ“‚ Step 4: Create Shipments Table
CREATE TABLE shipments (
shipment_id INT PRIMARY KEY,
customer_id INT,
warehouse_id INT,
shipment_date DATE,
delivery_date DATE,
shipping_cost DECIMAL(10,2),
shipment_status VARCHAR(30),
delivery_partner VARCHAR(100),
FOREIGN KEY (customer_id) REFERENCES customers(customer_id),
FOREIGN KEY (warehouse_id) REFERENCES warehouses(warehouse_id)
);

๐Ÿ“‚ Step 5: Insert Sample Customers
INSERT INTO customers VALUES
(1,'Rahul Sharma','Mumbai'),
(2,'Priya Verma','Delhi'),
(3,'Amit Patel','Pune'),
(4,'Sneha Joshi','Bangalore'),
(5,'Rohan Gupta','Hyderabad');

๐Ÿ“‚ Step 6: Insert Sample Warehouses
INSERT INTO warehouses VALUES
(101,'Mumbai Warehouse','Mumbai'),
(102,'Delhi Warehouse','Delhi'),
(103,'Pune Warehouse','Pune'),
(104,'Bangalore Warehouse','Bangalore');

๐Ÿ“‚ Step 7: Insert Sample Shipments
INSERT INTO shipments VALUES
(1001,1,101,'2025-01-05','2025-01-07',450,'Delivered','BlueDart'),
(1002,2,102,'2025-01-06','2025-01-09',620,'Delivered','DTDC'),
(1003,3,103,'2025-01-07','2025-01-11',780,'Delayed','Delhivery'),
(1004,4,104,'2025-01-08','2025-01-10',390,'Delivered','XpressBees'),
(1005,5,101,'2025-01-09','2025-01-14',950,'Delayed','BlueDart');

๐Ÿง  SQL Concepts You'll Practice
โœ” DDL & DML
โœ” INNER JOIN
โœ” LEFT JOIN
โœ” Aggregate Functions
โœ” GROUP BY
โœ” HAVING
โœ” CASE WHEN
โœ” Date Functions
โœ” CTEs
โœ” Window Functions
โœ” Ranking Functions

๐Ÿ“Š Business KPIs You Can Build
๐Ÿ“ˆ Total Shipments
๐Ÿ“ˆ Delivered Shipments
๐Ÿ“ˆ Delayed Shipments
๐Ÿ“ˆ Delivery Success Rate
๐Ÿ“ˆ Average Delivery Time
๐Ÿ“ˆ Total Shipping Cost
๐Ÿ“ˆ Shipping Cost by Warehouse
๐Ÿ“ˆ Shipping Cost by Delivery Partner
๐Ÿ“ˆ Shipments by City
๐Ÿ“ˆ Shipments by Warehouse
๐Ÿ“ˆ Delivery Partner Performance
๐Ÿ“ˆ Average Delivery Time by Partner
๐Ÿ“ˆ Warehouse Utilization
๐Ÿ“ˆ Peak Shipment Days
๐Ÿ“ˆ Monthly Shipment Trend
๐Ÿ“ˆ Customer-wise Shipments
๐Ÿ“ˆ On-Time Delivery Rate
๐Ÿ“ˆ Delayed Delivery Analysis
๐Ÿ“ˆ Cost per Shipment
๐Ÿ“ˆ Executive Logistics Dashboard

๐ŸŽฏ This project reflects real-world SQL analysis
Performed by Supply Chain Analysts, Logistics Analysts, Operations Analysts, and Business Intelligence professionals at e-commerce, courier, manufacturing, and retail companies to optimize delivery performance, reduce costs, and improve customer satisfaction.

๐Ÿ’ก Double Tap โค๏ธ For More
  • โค 8
More from @sqlanalyst
  1. Oct 9, 2026SQL Interview Series โ€” Part 5 ๐Ÿ“Œ Question 5: Find Employees Who Earn More Than Their Managโ€ฆ
  2. Oct 9, 2026๐Ÿ‡ฎ๐Ÿ‡ณ ๐—š๐—ข๐—ฉ๐—˜๐—ฅ๐—ก๐— ๐—˜๐—ก๐—ง ๐—ข๐—™ ๐—œ๐—ก๐——๐—œ๐—” โ€” ๐—”๐—œ๐—–๐—ง๐—˜ ๐—œ๐—ก๐—ง๐—˜๐—ฅ๐—ก๐—ฆ๐—›๐—œ๐—ฃ๐—ฆ ๐Ÿฎ๐Ÿฌ๐Ÿฎ๐Ÿฒ ๐Ÿš€โ€ฆ
  3. Oct 8, 2026๐ŸŽ“ ๐— ๐—ถ๐—ฐ๐—ฟ๐—ผ๐˜€๐—ผ๐—ณ๐˜ ๐—™๐—ฅ๐—˜๐—˜ ๐—–๐—ผ๐˜‚๐—ฟ๐˜€๐—ฒ๐˜€ ๐˜„๐—ถ๐˜๐—ต ๐—–๐—ฒ๐—ฟ๐˜๐—ถ๐—ณ๐—ถ๐—ฐ๐—ฎ๐˜๐—ฒ๐˜€! ๐Ÿš€๐Ÿ”ฅ Upgrโ€ฆ
  4. Oct 7, 2026๐Ÿš€๐—ฃ๐—ฎ๐˜† ๐—”๐—ณ๐˜๐—ฒ๐—ฟ ๐—ฃ๐—น๐—ฎ๐—ฐ๐—ฒ๐—บ๐—ฒ๐—ป๐˜ ๐—ง๐—ฟ๐—ฎ๐—ถ๐—ป๐—ถ๐—ป๐—ด | ๐—•๐—ฒ๐—ฐ๐—ผ๐—บ๐—ฒ ๐—ฎ ๐—™๐˜‚๐—น๐—น๐˜€๐˜๐—ฎ๐—ฐโ€ฆ
  5. Oct 7, 2026SQL Interview Series โ€” Part 4 ๐Ÿ“Œ Question 4: Find the Highest Salary in Each Department Suโ€ฆ
  6. Oct 7, 2026๐— ๐—ฎ๐˜€๐˜๐—ฒ๐—ฟ ๐—ฃ๐—ผ๐˜„๐—ฒ๐—ฟ ๐—•๐—œ ๐—ณ๐—ผ๐—ฟ ๐—™๐—ฅ๐—˜๐—˜! ๐Ÿ”ฅ Learn Power BI through these FREE learninโ€ฆ
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 โ†’