You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A real-world Supply Chain Management (SCM) database project focused on Non-Conformance Report (NCR) tracking, Purchase Orders, RTV (Return to Vendor), and Warehouse Stock Management — built using PostgreSQL 18.
🧑💼 Project Overview
This project simulates a real manufacturing and supply chain workflow where:
Defective materials are identified through NCR (Non-Conformance Reports)
Suppliers are monitored through quality and replacement activities
RTV (Return to Vendor) process is tracked
Warehouse stock is monitored after replacement activities
Purchase orders are linked to defective material handling
The project is inspired by real SCM operational activities such as:
NCR tracking
Supplier follow-up
Purchase order monitoring
Warehouse stock validation
RTV processing
SAP inventory movement handling
🔧 SAP Process References
This project reflects real operational activities using SAP transactions such as:
Transaction
Description
MB51
Material document list
LT01
Create Transfer Order
LT24
Transfer Orders for Material
LT31
Print Transfer Order
LS24
Quants in Storage Bin
QM03
Display Quality Notification
QM11
Create Quality Notification
ME23N
Display Purchase Order
ME2N
Purchase Orders by PO Number
ME5A
Purchase Requisition List
VL03N
Display Outbound Delivery
ZPUDP20
Custom SCM Report
ZPFSM
Custom Field Service Report
📦 Material Movement Types
Movement Type
Description
531
NCR stock movement — defective material received
541
RTV movement — material returned to vendor
🔄 Business Process Flow
1. Material received from supplier
↓
2. Quality team identifies defect → NCR raised
↓
3. NCR reviewed → Disposal decided (RTV / Scrap / Rework)
↓
4. Purchase Order created for replacement material
↓
5. Defective material dispatched to supplier (RTV)
↓
6. Supplier sends replacement → Warehouse stock updated
🗂️ Project Structure
scm_ncr_sql_project/
│
├── schema/
│ └── create_tables.sql # All CREATE TABLE statements with FK constraints
│
├── queries/
│ ├── 01_basic_queries.sql # Q1–Q20 → SELECT, WHERE, ORDER BY, LIMIT, LIKE
│ ├── 02_aggregations.sql # Q21–Q40 → GROUP BY, COUNT, SUM, AVG, HAVING
│ ├── 03_joins.sql # Q41–Q60 → INNER JOIN, LEFT JOIN, Multi-table JOINs
│ ├── 04_subqueries.sql # Q61–Q80 → Subqueries, EXISTS, IN, NOT IN
│ ├── 05_advanced_analytics.sql # Q81–Q100 → Window Functions, CTEs, CASE WHEN
│ └── 06_bonus_queries.sql # B1–B38 → Real-world SCM business queries
│
├── erd/
│ └── scm_ncr_erd.png # Entity Relationship Diagram
│
├── docs/
│ └── project_summary.md # Business context and insights
│
└── README.md
🗄️ Database Tables
Table
Columns
Description
suppliers
id, vendor_name, city, contact_person, phone_number