๐ 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
Post #2628
3.64K
- โค 8