โจ Daily SQL Problems
โจ Real-World Scenarios
โจ Complete Solutions
โจ Interview Ready
Click this link to get the CSV files:
Get Dataset (4 tables: subscriptions, users, plans, payment_history)Amazon's subscription team needs comprehensive churn analysis to reduce cancellations, optimize pricing, and predict renewal patterns.
| subscription_id | user_id | plan_id | start_date | end_date | status |
|---|---|---|---|---|---|
| SUB001 | U1001 | p01 | 2023-01-15 | 2024-01-15 | active |
| sub002 | u1002 | P02 | 15/06/2023 | NULL | CANCELLED |
| SUB003 | U1003 | p01 | 2023-03-20 | 2024-03-20 | Active |
| Sub004 | u1004 | P03 | 2023/07/10 | 10-01-2024 | expired |
| user_id | user_name | country |
|---|---|---|
| U1001 | alice johnson | USA |
| u1002 | BOB SMITH | uk |
| U1003 | Carlos Martinez | SPAIN |
| u1004 | DIANA CHEN | china |
| plan_id | plan_name | price_monthly | billing_cycle |
|---|---|---|---|
| p01 | Prime Monthly | 14.99 | monthly |
| P02 | PRIME ANNUAL | 139.00 | yearly |
| p03 | Student Prime | 7.49 | MONTHLY |
| P04 | family plan | 19.99 | Monthly |
| payment_id | subscription_id | payment_date | amount | payment_status |
|---|---|---|---|---|
| PAY001 | SUB001 | 2023-01-15 | 14.99 | success |
| pay002 | sub002 | 15/06/2023 | 139.00 | FAILED |
| PAY003 | SUB003 | 2023-03-20 | 14.99 | Success |
Download full dataset above (30+ rows per table)
Build comprehensive churn analysis system for Amazon's subscription business.
๐ก CASE, DATEDIFF, COALESCE, Multi-JOINs, GROUP BY, Subqueries!
Download the PDF for complete solution with hints!
Master subscription analytics
Build churn prediction models
Analyze retention with SQL
Day 22 coming tomorrow!
Rahul Kanche โ exploring data, decoding clarity!