You have been asked to calculate the rolling average for book sales in 2022.
A rolling average continuously updates a data set's average to include all data in the set up to that point. For example, the rolling average for February would be calculated by adding the book sales from January and February and dividing by two; the rolling average for March would be calculated by adding the book sales from January, February, and March and dividing by three; and so on.
Output the month, the sales for that month, and an extra column containing the rolling average rounded to the nearest whole number.
00:00 - What is a Window Function?
04:22 - Rolling Average Problem
Companies appeared in: Amazon
Difficulty: Medium
Ideas: SQL Window Functions (AVG), Common Table Expressions (CTE)
Problem: t.ly/mJLw7
Негізгі бет Monthly Sales Rolling Average - Amazon Interview Question - SQL
Пікірлер: 3