Alibaba
Interview Core Track · Hard · 35 min
Rolling Three-day Earnings
At Alibaba, analysts are preparing a scorecard focused on rolling three-day earnings. Return each user_id, transaction_date, and rolling_3_day_earnings based...
Company labels are directional practice context, not official interview guidance.
Objective
Practice query basics through a Alibaba-tagged business scenario.
Approach
Use this track to improve speed, edge-case handling, and accuracy under timed conditions.
Company context
Company labels are directional practice context, not official interview guidance.
At Alibaba, analysts are preparing a scorecard focused on rolling three-day earnings. Return each user_id, transaction_date, and rolling_3_day_earnings based on the current day plus the previous two transaction dates for that user. Sort by user_id and transaction_date.
daily_earnings
| user_id | transaction_date | amount |
|---|---|---|
| 10 | 2024-01-01 | 50 |
| 10 | 2024-01-02 | 20 |
| 10 | 2024-01-03 | 60 |
| 10 | 2024-01-04 | 40 |
| 20 | 2024-01-01 | 15 |
| 20 | 2024-01-03 | 25 |
| 20 | 2024-01-04 | 30 |
SQL workspace
Run queries against the protected question data, then submit once the result shape looks right.
Sign in to run SQL
Create a free account or sign in before running queries against protected question data.