Repeat Purchase Curves for Big Billion Days First-Time Buyers
Last updated: November 29, 2026
Quick Overview
Using an orders table, compare repeat-purchase rates in 30-day periods for customers whose first valid order was during Big Billion Days against customers acquired at other times in the same two months.
Flipkart
November 29, 20260
0
0 solved
Using an orders table, compare repeat-purchase rates in 30-day periods for customers whose first valid order was during Big Billion Days against customers acquired at other times in the same two months.
Flipkart acquires a large wave of first-time buyers during Big Billion Days, and leadership asks whether those users stick or were only deal seekers. The SQL round checks cohort construction, defining a first order correctly when cancellations and returns exist, building a full period grid so zero cells appear, and awareness of right-censoring.
What the Interviewer Expects
- Define first order on valid (non-cancelled, non-returned) orders across all history
- Assign cohorts by first-order date relative to the sale window
- Use day-based 30-day periods so late-month buyers are not penalized
- Count distinct repeat buyers per period and divide by cohort size
- Produce a complete cohort by period grid with zeros
- Discuss censoring for periods not yet fully observed
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 restrict to periods that are fully observed as of today?
- How would you control for the fact that BBD buyers skew toward electronics, which has a long repurchase cycle?
- How would you turn this into GMV retention instead of user retention?
- How would you write this in pandas for an ad hoc notebook?
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
orders(order_id, user_id, order_ts, status) with statuses including DELIVERED, CANCELLED, RETURNED and RTO (return to origin). The sale ran 2026-09-27 to 2026-10-03. Comparison cohort: users whose f...
Approach
- Filter valid orders.
- First valid order date per user across all history (so returning users are not counted as new).
- Label cohort and restrict to first orders in the two-month window.
- Map ...