Advertiser Status

ASKED IN INTERVIEW
10pts
Meta

Problem Statement

Update the status of Meta advertisers. Use the provided transition rules to determine the new status for each user based on today's payment activity.

Rules:

  • Output columns: user_id, updated_status.
  • New + Payment = Active
  • New + No Payment = Churn
  • Active + Payment = Active
  • Active + No Payment = Churn
  • Churn + Payment = Resurrect
  • Churn + No Payment = Churn
  • NULL + Payment = New
  • Sort by user_id ASC.
Tests your understanding of
Case Logic, Full Outer Join and Conditional Formatting

Input Tables

advertiser
user_id(VARCHAR)status(VARCHAR)
bingNew
yahooChurn
alibabaActive
daily_pay
user_id(VARCHAR)paid(DECIMAL)
bing500
alibaba0
target100
ad_accounts
user_id(VARCHAR)account_type(VARCHAR)
bingBusiness

Expected Output

user_id(VARCHAR)updated_status(VARCHAR)
alibabaChurn
bingActive
targetNew
yahooChurn

Tags

HardASKED IN INTERVIEWCase LogicFull Outer JoinConditional Formatting
20-30 min
41%

Hints