All jobs / Data analyst / BI / SQL
Data analyst / BI interview question · 1–3 years
You join orders to refunds (many refunds per order) then average order value. What bites you?
The strongest answer
The average is now refund-weighted unless you pre-aggregate refunds to order grain — fan-out changes the denominator
Why it works
Exactly. Pre-agg to the grain you will average. DISTINCT on amount is a different lie.
What a good answer covers
- Pre-aggregate to the measure grain.
- Fan-out changes weights.
- More rows ≠ more units.
- Do not DISTINCT the measure.
Answers that fall short
- Close, but not the strongest: Nothing; more rows are more data
More rows are not more orders. - Weak: Averages ignore duplicates automatically
Averages do not de-duplicate keys. - Red flag: I DISTINCT the amount column to fix it
DISTINCT amount collapses different orders that share a price.
Who gets asked this
More SQL questions
- A customer dimension has two rows per person after an address change. How do you join a fact?
- A “helpful” dashboard takes a raw table name from a query string. What do you say?
- You want each user’s first paid order date next to every order. How?
- A query that was fine on a sample scans the lake for 20 minutes in prod. What do you look at?
- A popular dashboard scans a year of raw events every open. What do you do?
- A junior’s query is correct and unreadable. How do you review?
- You need “the plan the customer was on when they churned.” What join?
- A stakeholder asks for “orders per customer.” What do you pin down first?