Daily Crypto Volume and Day-over-Day Change
Problem
**[Asked at Coinbase]**
Coinbase wants to monitor daily trading activity. For each cryptocurrency and
each trade date, calculate:
1. `daily_volume` — total volume traded that day
2. `volume_change` — difference from the previous day's volume for the
same currency (`current - previous`, NULL on the first day)
Return `trade_date`, `currency`, `daily_volume`, and `volume_change`,
ordered by currency then date.
Tables
Example rows — the live problem includes the full dataset.
| trade_id | user_id | currency | trade_date | volume |
|---|
Expected output
Your answer should return 6 rows with the columns trade_date, currency, daily_volume, volume_change.
Starter code (SQL)
SELECT *
FROM crypto_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