Monthly Sales Rolling Average - Amazon Interview Question - SQL

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

Пікірлер: 2

  • @krishnayadav-rb2ei
    @krishnayadav-rb2ei20 күн бұрын

    Very good information for finding out the sales of a company per month etc to decide the policies

  • @krishnayadav-yj6ph
    @krishnayadav-yj6ph20 күн бұрын

    Please make the contents readable on mobile screans Contents are very informative for those dealing with huge data in companies like Amazone