SpinTheMic
Pro

Interview practice question

Rolling 7-day unique buyers

Data Analyst · SQL for Analytics · Intermediate

You need a daily chart of unique buyers in the trailing seven days. Why can't you just use COUNT(DISTINCT) as a window function, and what do you do instead?

What a strong answer covers

Your AI report card counts how many of these ideas you cover.

  • Most DBs don't support DISTINCT in window frames.
  • Summing daily uniques double counts.
  • Join date spine to purchases in 7-day range.
  • Or HLL sketches merged per window.
  • Validate on sample.
Practise this topic

Start without signing up. Sign in free to get an AI report card on your answer.

See all topics