A collection of end-to-end SQL case studies from Danny Ma's 8-Week SQL Challenge, engineered to solve real-world business problems using advanced relational database querying and analytical reporting.
-
Database Engine: PostgreSQL
-
Core Concepts:
- Multi-table Joins (
INNER,LEFT,CROSS JOIN) - Data Aggregation & Grouping (
GROUP BY,HAVING, Filtered Aggregations) - Window Functions (
ROW_NUMBER(),DENSE_RANK(),RANK(),LEAD(),LAG()) - Common Table Expressions (CTEs /
WITHClauses) & Subqueries - Conditional Business Logic (
CASE WHEN) - Date/Time Parsing & Timestamps
- Multi-table Joins (
| # | Case Study | Business Focus | Status | Case Study & Solutions |
|---|---|---|---|---|
| 1 | Danny's Diner | Customer spending, visiting patterns & loyalty points | 🟢 Complete | 📖 README • 🛠️ setup.sql • 💻 solutions.sql |
| 2 | Pizza Runner | Delivery metrics, runner efficiency & operations | ⚪ In Progress | Upcoming |
| 3 | Foodie-Fi | Subscription churn, onboarding & payment analysis | ⚪ Backlog | Upcoming |
| 4 | Data Bank | Customer transactions, data allocation & storage | ⚪ Backlog | Upcoming |
| 5 | Data Mart | Sales impact analysis & cleaning time-series data | ⚪ Backlog | Upcoming |
| 6 | Clique Bait | E-commerce funnel, campaign conversion & tracking | ⚪ Backlog | Upcoming |
| 7 | Balanced Tree Clothing | Retail sales, product revenue & transaction analysis | ⚪ Backlog | Upcoming |
| 8 | Fresh Segments | Customer interest metrics & composition analysis | ⚪ Backlog | Upcoming |
Each case study directory is structured as a self-contained module:
8-Week-SQL-Challenge/
│
├── README.md
│ └── Master project overview
│
└── Case Study 1 - Danny's Diner/
├── README.md
│ └── Problem breakdown & business insights
│
├── setup.sql
│ └── Schema DDL and sample data insertion
│
└── solutions.sql
└── Clean, executable PostgreSQL solutions
git clone https://github.com/Omkesh-Bash/8-Week-SQL-Challenge.gitcd "Case Study 1 - Danny's Diner"Run setup.sql in your local PostgreSQL terminal or client, such as DBeaver or psql, to initialize the database schema and populate the tables.
Run solutions.sql to execute the queries and verify the expected outputs.
psql -d your_database -f setup.sql
psql -d your_database -f solutions.sqlThis portfolio demonstrates practical SQL skills through progressively complex business problems, including:
- Customer behavior analysis
- Sales and revenue analysis
- Subscription and churn analysis
- Delivery and operational performance
- E-commerce funnel analysis
- Retail transaction analysis
- Customer segmentation
- Time-series data analysis
- Advanced SQL querying and reporting
The 8-Week SQL Challenge was created by Danny Ma to help data professionals strengthen their SQL skills through real-world case studies.
Each case study focuses on a different business scenario and requires analytical thinking, data exploration, and progressively advanced SQL techniques.