Skip to main content

ISA-003 Null Value Handling

🟢 Beginner

⏱ 15 Minutes

⭐ 10 Points

🔓 Free

💻 SQL | PySpark

🏢 Retail Analytics


Business Context

A retail company receives customer records from multiple source systems.

Some customer records arrive without email addresses.

Marketing campaigns require a valid email value for every customer record.

The analytics team has decided that whenever an email is missing, it should be replaced with:

unknown@example.com

before loading the data into reporting systems.


Dataset

customer_contacts
customer_idcustomer_nameemail
101Johnjohn@example.com
102Alice
103Bobbob@example.com
104Sarah
105Daviddavid@example.com

Task

Replace all NULL email values with:

unknown@example.com

Return all customer records.


Expected Output

expected_output
customer_idcustomer_nameemail
101Johnjohn@example.com
102Aliceunknown@example.com
103Bobbob@example.com
104Sarahunknown@example.com
105Daviddavid@example.com

Constraints

  • Email values may contain NULL.
  • Replace only NULL email values.
  • Existing email addresses must remain unchanged.
  • Return all customer records.

Supported Languages

✅ SQL

✅ PySpark


Hint

Replace missing email values using a function that provides a default value when NULL is encountered.


Solution

🔒 Premium Solution

Premium members receive:

  • SQL Solution
  • PySpark Solution
  • Step-by-Step Explanation
  • Optimization Discussion

Notebook Workspace

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