30-Day Rolling Average Trading Volume
Problem
**[Asked at Goldman Sachs]**
Goldman's analytics team tracks daily trading volumes for each client.
For each client and each trading day, compute the **30-day trailing average
volume** (current day + the 29 preceding days).
Return `client_id`, `trade_date`, and `rolling_avg_30d` rounded to 2 dp,
ordered by client then date.
Tables
Example rows — the live problem includes the full dataset.
client_trades
| trade_id | client_id | trade_date | daily_volume |
|---|
Expected output
Your answer should return 8 rows with the columns client_id, trade_date, rolling_avg_30d.
Starter code (SQL)
SELECT *
FROM client_trades;Solve this SQL question free
Write SQL and run it instantly in your browser — even on your phone. No signup needed to try.
Solution & explanation
Create a free account to unlock the optimal solution, a step-by-step explanation, and the hidden test cases that grade your answer.
Sign up free to unlock