Skip to main content

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_profiles
customer_idcustomer_namecountry
101JohnIndia
102Alice
103BobUSA
104Sarah
105DavidCanada

Task

Replace all NULL country values with:

Unknown

Return all customer records.


Expected Output

expected_output
customer_idcustomer_namecountry
101JohnIndia
102AliceUnknown
103BobUSA
104SarahUnknown
105DavidCanada

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

Notebook Workspace

Cell 1Dataset: customer_profiles
15:00
Loading...
Run Results
✓ Workspace Ready
Rows Returned: --
Execution Time: --
Engine: Coming Soon
Execution Engine Coming Soon