Share of Customers Whose First Order Included Large Furniture

Last updated: November 29, 2026

Quick Overview

Using orders and order_items tables, compute for each month of first purchase the share of new customers whose first order contained at least one item from the large-parcel furniture class.

Wayfair
Data Manipulation (SQL/Python)
Data Scientist
Wayfair
November 29, 2026
Data Scientist
Technical Screen
Data Manipulation (SQL/Python)
Easy

0

0

0 solved


Using orders and order_items tables, compute for each month of first purchase the share of new customers whose first order contained at least one item from the large-parcel furniture class.

Whether a customer starts with a sofa or with a throw pillow changes their delivery experience and repeat behavior, so Wayfair analytics teams cut cohorts this way constantly. The screen checks window functions for 'first order', correct handling of ties, and avoiding double counting when an order has many items.

What the Interviewer Expects
  • Identifies each customer's first order with ROW_NUMBER or MIN
  • Breaks ties deterministically when two orders share a timestamp
  • Collapses items to an order-level flag before averaging
  • Groups by first-order month
  • Excludes cancelled orders after clarifying
Key Topics to Cover
window functions
cohorts
SQL
deduplication
aggregation
How to Approach This
  1. Clarify the schema and expected output format before writing queries.
  2. Use CTEs (WITH clauses) to break complex queries into readable steps.
  3. Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
  4. Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
  5. For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
  • How would you extend this to compare 12-month repeat rate between the two groups?
  • Some 'first orders' are actually returning customers with a new account. How would you detect that?
  • How would you write this in BigQuery for a table with billions of order items?
  • Would you count an order that was fully cancelled?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice SQL Problems
Sample Answer
Clarify the Data

Assume orders(order_id, customer_id, placed_at, status) and order_items(order_id, sku, product_class, qty), where product_class = 'large_parcel' marks items that ship freight or white-glove. Cla...

Approach
  1. Rank each customer's valid orders by time to find the first.
  2. Build an order-level flag has_large with MAX(CASE ...) so an order with three large items counts once.
  3. Join the flag to first ...

Submit Your Answer
Markdown supported

Related Questions