ISA-008 — Missing Country Assignment
🟢 Beginner
⏱ 15 Minutes
⭐ 10 Points
🔓 Free
💻 SQL | PySpark
🏢 Retail Analytics
Business Context
A retail company receives customer records from multiple regional systems.
Some customer records arrive without country information.
Several reporting dashboards require a valid country value for segmentation and regional analysis.
The analytics team has decided that whenever country information is missing, it should be assigned a default value before loading into reporting systems.
Business Impact
Missing country information can cause:
- Incorrect regional reporting
- Broken dashboard filters
- Inaccurate customer segmentation
- Data quality issues
Standardizing missing country values improves reporting consistency across the organization.
Dataset
| customer_id | customer_name | country |
|---|---|---|
| 101 | John | India |
| 102 | Alice | |
| 103 | Bob | USA |
| 104 | Sarah | |
| 105 | David | Canada |
Task
Replace all NULL country values with:
Unknown
Return all customer records.
Expected Output
| customer_id | customer_name | country |
|---|---|---|
| 101 | John | India |
| 102 | Alice | Unknown |
| 103 | Bob | USA |
| 104 | Sarah | Unknown |
| 105 | David | Canada |
Constraints
- Country values may contain NULL.
- Replace only NULL values.
- Existing country values must remain unchanged.
- Return all customer records.
Supported Languages
✅ SQL
✅ PySpark
Hint
Apply a default value whenever country is missing.
Solution
🔒 Premium Solution
Premium members receive:
- SQL Solution
- PySpark Solution
- Step-by-Step Explanation
- Optimization Discussion