User Spend Segmentation by Category
A hard SQL mock interview question on DataDriven. Practice with AI-powered feedback, real code execution, and a hire/no-hire decision.
- Domain
- SQL
- Difficulty
- hard
- Seniority
- L5
Interview Prompt
Compute each user's average basket size (total spend / transaction count) per category from transactions combined with products. Label 'High' if over $500, 'Medium' between $200 and $500, 'Low' under $200. Then produce a per-category, per-segment summary: unique users, total transactions, total sales, and average basket size. Return the category, segment, unique users, total transactions, total sales, and average basket size.
Summary
Users segmented by spending behavior.
How This Interview Works
- Read the vague prompt (just like a real interview)
- Ask clarifying questions to the AI interviewer
- Write your sql solution with real code execution
- Get instant feedback and a hire/no-hire decision