Rolling Bank Transactions
Start Timer
0:00:00
We’re given a table of bank transactions with three columns, user_id
, a deposit or withdrawal value (determined if the value is positive or negative), and created_at
time for each transaction.
Write a query to get the total three-day rolling average for deposits by day.
Note: Please use the format '%Y-%m-%d'
for the date in the outout
Example:
Input:
bank_transactions
table
Column | Type |
---|---|
user_id |
INTEGER |
created_at |
DATETIME |
transaction_value |
FLOAT |
Output:
Column | Type |
---|---|
dt |
VARCHAR |
rolling_three_day |
FLOAT |
Recommended questions for you
Personalized based on your user activity, skill level, and preferences.
.
.
.
.
.
.
.
.
.
Comments