Classify Marketplace Sellers as New, Retained, Resurrected or Churned Monthly
Last updated: November 29, 2026
Quick Overview
From third-party seller order data, label every month's active sellers as new, retained from the prior month, or resurrected after a gap, and count sellers who churned (active last month but not this month).
Amazon
November 29, 20260
0
0 solved
From third-party seller order data, label every month's active sellers as new, retained from the prior month, or resurrected after a gap, and count sellers who churned (active last month but not this month).
A growth accounting question in the style of Amazon's third-party seller analytics, where seller health reviews break active seller counts into inflows and outflows. The interviewer checks LAG and LEAD use, the extra churn rows that do not exist in the activity table, and an accounting identity to validate the result.
What the Interviewer Expects
- Build one row per seller per active month
- Use LAG to label new, retained and resurrected
- Use LEAD to generate churn rows in the month after the last active month of a streak
- Avoid counting churn in a month beyond the data
- Validate with the identity active(M-1) = retained(M) + churned(M)
Key Topics to Cover
How to Approach This
- Clarify the schema and expected output format before writing queries.
- Use CTEs (WITH clauses) to break complex queries into readable steps.
- Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
- Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
- For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
- How would you compute the quick ratio (new plus resurrected) divided by churned?
- How would you weight these by GMV instead of seller count?
- How would you define activity for a seller with listings but no orders?
- How would you extend the labels to distinguish long-dormant resurrection from one-month gaps?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice SQL ProblemsSample Answer
Clarify the Data
Table seller_orders(order_id, seller_id, order_ts, gmv). A seller is active in a month if they have at least one order that month. Definitions:
- new: active this month, first ever active month....
Approach
New, retained and resurrected are properties of rows that exist: each active seller month looks back with LAG. Churn is a property of a month where the seller has no row, so I generate it from the l...