← 返回 amazon 的题目列表7-Day Rolling Average of User Activity Using SQL Window Functions
类型:online_judge
amazon
Design an SQL query to calculate the 7-day rolling average of user activity on an e-commerce website. Consider using window functions and other appropriate SQL tools for performance optimization. Provide the table structure and sample text data if necessary. The calculation should return the rolling average of user activity for each day.
Example
Input
date,activity
2023-01-01,100
2023-01-02,150
2023-01-03,200
2023-01-04,250
2023-01-05,300
2023-01-06,350
2023-01-07,400
2023-01-08,450