ISA-009 — Product Category Correction
🟢 Beginner
⏱ 20 Minutes
⭐ 15 Points
🔓 Free
💻 SQL | PySpark
🏢 Retail Analytics
Business Context
A retail company receives product data from multiple vendors.
Each vendor uses different naming conventions for product categories.
As a result, the same category appears in multiple formats.
Examples:
- electronics
- Electronics
- ELECTRONICS
All represent the same business category.
The analytics team must standardize category names before loading them into reporting systems.
Business Impact
Inconsistent category values can cause:
- Incorrect sales reporting
- Duplicate category entries
- Broken dashboard filters
- Inaccurate inventory analytics
Standardized categories improve reporting accuracy and simplify downstream analytics.
Dataset
| product_id | product_name | category |
|---|---|---|
| P101 | Laptop | electronics |
| P102 | Mobile | ELECTRONICS |
| P103 | Shirt | clothing |
| P104 | Jeans | CLOTHING |
| P105 | Television | Electronics |
Task
Standardize all category values.
Use the following business standard:
- Electronics
- Clothing
Return all product records.
Expected Output
| product_id | product_name | category |
|---|---|---|
| P101 | Laptop | Electronics |
| P102 | Mobile | Electronics |
| P103 | Shirt | Clothing |
| P104 | Jeans | Clothing |
| P105 | Television | Electronics |
Constraints
- Category values may contain inconsistent capitalization.
- All category values should follow Proper Case.
- Return all product records.
Supported Languages
✅ SQL
✅ PySpark
Hint
Convert category values into a consistent capitalization format before returning the results.
Solution
🔒 Premium Solution
Premium members receive:
- SQL Solution
- PySpark Solution
- Step-by-Step Explanation
- Optimization Discussion